Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 44014 invoked from network); 15 Jan 2007 11:46:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jan 2007 11:46:53 -0000 Received: (qmail 58510 invoked by uid 500); 15 Jan 2007 11:46:59 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 58493 invoked by uid 500); 15 Jan 2007 11:46:59 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 58484 invoked by uid 99); 15 Jan 2007 11:46:59 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jan 2007 03:46:59 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jan 2007 03:46:52 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id CFAAA1A981F; Mon, 15 Jan 2007 03:45:49 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r496284 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java Date: Mon, 15 Jan 2007 11:45:49 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070115114549.CFAAA1A981F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Mon Jan 15 03:45:48 2007 New Revision: 496284 URL: http://svn.apache.org/viewvc?view=rev&rev=496284 Log: Applied HARMONY-2810 [classlib][awt] JUnit AWT-based TestRunner can't be started Tested on J9/SUSE9@ia32 Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java?view=diff&rev=496284&r1=496283&r2=496284 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java Mon Jan 15 03:45:48 2007 @@ -48,6 +48,8 @@ private static final long serialVersionUID = -3304312411574666869L; private final static int BORDER_SIZE = 2; + + private final static Font DEFAULT_FONT = new Font("dialog", Font.PLAIN, 12); //$NON-NLS-1$ private final AWTListenerList actionListeners = new AWTListenerList( this); @@ -1409,8 +1411,13 @@ } private Dimension getMaxCharSize(Graphics g) { - FontRenderContext frc = ((Graphics2D) g).getFontRenderContext(); - return getFont().getStringBounds("W", frc).getBounds().getSize(); //$NON-NLS-1$ + final FontRenderContext frc = ((Graphics2D) g).getFontRenderContext(); + return getListFont().getStringBounds("W", frc).getBounds().getSize(); //$NON-NLS-1$ + } + + private Font getListFont() { + final Font f = getFont(); + return f == null ? DEFAULT_FONT : f; } private void doRepaint(Rectangle r) { @@ -1446,7 +1453,7 @@ @SuppressWarnings("deprecation") private Dimension getItemSize() { - FontMetrics fm = toolkit.getFontMetrics(getFont()); + FontMetrics fm = toolkit.getFontMetrics(getListFont()); int itemHeight = fm.getHeight() + 2; return new Dimension(prefWidth - 2 * BORDER_SIZE, itemHeight); }