[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: reimplemented getPreferredSize for JTextField

Kaffe CVS cvs-commits at kaffe.org
Wed Dec 22 18:02:55 PST 2004


PatchSet 5714 
Date: 2004/12/23 01:58:51
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: reimplemented getPreferredSize for JTextField

Members: 
	ChangeLog:1.3259->1.3260 
	libraries/javalib/javax/swing/JTextField.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3259 kaffe/ChangeLog:1.3260
--- kaffe/ChangeLog:1.3259	Thu Dec 23 01:46:24 2004
+++ kaffe/ChangeLog	Thu Dec 23 01:58:51 2004
@@ -1,5 +1,15 @@
 2004-12-22  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/javax/swing/JTextField.java:
+	Resynced with GNU Classpath.
+
+	2004-12-22  Michael Koch  <konqueror at gmx.de>
+
+	* javax/swing/JTextField.java (getPreferredSize):
+	Re-implemented.
+
+2004-12-22  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/javax/swing/plaf/basic/BasicEditorPaneUI.java:
 	Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/javax/swing/JTextField.java
diff -u kaffe/libraries/javalib/javax/swing/JTextField.java:1.5 kaffe/libraries/javalib/javax/swing/JTextField.java:1.6
--- kaffe/libraries/javalib/javax/swing/JTextField.java:1.5	Wed Sep 29 04:23:57 2004
+++ kaffe/libraries/javalib/javax/swing/JTextField.java	Thu Dec 23 01:58:52 2004
@@ -35,6 +35,7 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Dimension;
@@ -50,7 +51,6 @@
 import javax.swing.text.JTextComponent;
 import javax.swing.text.PlainDocument;
 
-
 public class JTextField extends JTextComponent
   implements SwingConstants
 {
@@ -272,19 +272,10 @@
 
   public Dimension getPreferredSize()
   {
-    Dimension size;
-    FontMetrics fm = getFontMetrics(getFont());
-    int fontHeight = fm.getMaxAscent() + fm.getMaxDescent();
-    int columnWidth = fm.charWidth('m');
-    
+    Dimension size = super.getPreferredSize();
+
     if (columns != 0)
-      {
-	size = new Dimension(columns * columnWidth + 4, fontHeight + 4);
-      }
-    else
-      {
-	size = new Dimension(10, 10);
-      }
+      size.width = columns * getColumnWidth();
 
     return size;
   }




More information about the kaffe mailing list