Seems like javax.swing.text was broken for some days. This patch fixes
this. See ChangeLog entries.

2006-03-10  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/WrappedPlainView.java
        (metrics): Made field package private to avoid accessor method.
        (WrappedLine.paint): Call drawLine with y offset of the font
ascent.
        The drawLine (righly) interprets the y parameter as the
baseline.
        * javax/swing/text/Utilities.java
        (getBreakLocation): Don't consider the offset. The returned
value
        for getTabbedTextOffset is already relative to the offset.

/Roman
-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/text/Utilities.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/Utilities.java,v
retrieving revision 1.24
diff -u -r1.24 Utilities.java
--- javax/swing/text/Utilities.java	3 Mar 2006 10:47:11 -0000	1.24
+++ javax/swing/text/Utilities.java	10 Mar 2006 22:08:43 -0000
@@ -515,7 +515,7 @@
     breaker.setText(s);
 
     // If mark is equal to the end of the string, just use that position
-    if (mark == s.count + s.offset)
+    if (mark >= s.count)
       return mark;
     
     // Try to find a word boundary previous to the mark at which we 
Index: javax/swing/text/WrappedPlainView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/WrappedPlainView.java,v
retrieving revision 1.10
diff -u -r1.10 WrappedPlainView.java
--- javax/swing/text/WrappedPlainView.java	21 Feb 2006 15:37:08 -0000	1.10
+++ javax/swing/text/WrappedPlainView.java	10 Mar 2006 22:08:43 -0000
@@ -45,7 +45,6 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 
-import javax.swing.SwingConstants;
 import javax.swing.event.DocumentEvent;
 import javax.swing.text.Position.Bias;
 
@@ -64,8 +63,11 @@
   /** The color for disabled components **/
   Color disabledColor;
   
-  /** Stores the font metrics **/
-  protected FontMetrics metrics;
+  /**
+   * Stores the font metrics. This is package private to avoid synthetic
+   * accessor method.
+   */
+  FontMetrics metrics;
   
   /** Whether or not to wrap on word boundaries **/
   boolean wordWrap;
@@ -234,7 +236,6 @@
       g.setColor(unselectedColor);
     else
       g.setColor(disabledColor);
-
     Segment segment = getLineBuffer();
     getDocument().getText(p0, p1 - p0, segment);
     return Utilities.drawTabbedText(segment, x, y, g, this, p0);
@@ -440,7 +441,7 @@
       while (currStart < end)
         {
           currEnd = calculateBreakPosition(currStart, end);
-          drawLine(currStart, currEnd, g, rect.x, rect.y);
+          drawLine(currStart, currEnd, g, rect.x, rect.y + metrics.getAscent());
           rect.y += lineHeight;          
           if (currEnd == currStart)
             currStart ++;

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to