2005-08-16  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/text/PasswordView.java
        (drawUnselectedText): Fixed so the password is drawn correctly
        in the text box and no * characters are drawn before anything
        was typed.

Index: javax/swing/text/PasswordView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/PasswordView.java,v
retrieving revision 1.5
diff -u -r1.5 PasswordView.java
--- javax/swing/text/PasswordView.java	16 Aug 2005 16:12:27 -0000	1.5
+++ javax/swing/text/PasswordView.java	16 Aug 2005 19:41:51 -0000
@@ -152,22 +152,28 @@
 
     // Get echo character.
     char ch = getEchoChar();
+    Segment segment = new Segment();
 
     // Set color for unselected text.
     g.setColor(unselectedColor);
     g.setColor(Color.BLACK);
 
     // Initialize buffer for faster drawing of all characters.
-    int len = p1 - p0;
+    p1--;
+    getDocument().getText(p0, p1 - p0, segment);
+    int len = segment.toString().length();
+    
     char[] buffer = new char[len];
     for (int index = 0; index < len; ++index)
       buffer[index] = ch;
-
+    
+    y += getPreferredSpan(Y_AXIS)/2;
+    
     // Draw echo charaters.
     g.drawChars(buffer, 0, len, x, y);
-
+    
     // Return new x position right of all drawn characters.
-    return x + len * metrics.charWidth(ch);
+    return x + (len * metrics.charWidth(ch));
   }
 
   /**
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to