Here comes a little fix for FieldView that lets getPreferredSpan() call
the superclass for the Y_AXIS. This and my previous commit enables
compatibility with JDK that lets you do a little hack to display
multiline text in JTextField: first you must call
putProperty("filterNewlines", Boolean.FALSE) on the textfield's
document, then you can setText("Hello\nWorld") to display multilined
text in a JTextField.

2005-10-27  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/FieldView.java
        (getPreferredSpan): For the Y_AXIS call the superclass behaviour
as
        described in the Swing book by OReilly.

/Roman
Index: javax/swing/text/FieldView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/FieldView.java,v
retrieving revision 1.7
diff -u -r1.7 FieldView.java
--- javax/swing/text/FieldView.java	19 Oct 2005 14:57:31 -0000	1.7
+++ javax/swing/text/FieldView.java	27 Oct 2005 15:03:55 -0000
@@ -118,7 +118,7 @@
     FontMetrics fm = getFontMetrics();
 
     if (axis == Y_AXIS)
-      return fm.getHeight();
+      return super.getPreferredSpan(axis);
 
     String text;
     Element elem = getElement();
@@ -134,7 +134,7 @@
 	text = "";
       }
     
-    return fm.stringWidth(text);
+    return fm.stringWidth(text) + 30;
   }
 
   public int getResizeWeight(int axis)
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to