summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax/swing/text/PasswordView.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-10 21:46:48 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-10 21:46:48 +0000
commitce57ab760f69de6db452def7ffbf5b114a2d8694 (patch)
treeea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/javax/swing/text/PasswordView.java
parent50996fe55769882de3f410896032c887f0ff0d04 (diff)
downloadppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz
ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.zip
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore. * gnu/classpath/jdwp/VMFrame.java (SIZE): New constant. * java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5. * java/lang/Math.java: New override file. * java/lang/Character.java: Merged from Classpath. (start, end): Now 'int's. (canonicalName): New field. (CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants. (UnicodeBlock): Added argument. (of): New overload. (forName): New method. Updated unicode blocks. (sets): Updated. * sources.am: Regenerated. * Makefile.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/text/PasswordView.java')
-rw-r--r--libjava/classpath/javax/swing/text/PasswordView.java44
1 files changed, 10 insertions, 34 deletions
diff --git a/libjava/classpath/javax/swing/text/PasswordView.java b/libjava/classpath/javax/swing/text/PasswordView.java
index e54331c5a8e..9d4c86a8388 100644
--- a/libjava/classpath/javax/swing/text/PasswordView.java
+++ b/libjava/classpath/javax/swing/text/PasswordView.java
@@ -107,8 +107,6 @@ public class PasswordView
protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- // FIXME: Throw BadLocationException somehow.
-
// Update font metrics.
updateMetrics();
@@ -119,25 +117,18 @@ public class PasswordView
g.setColor(selectedColor);
g.setColor(Color.BLACK);
- // Initialize buffer for faster drawing of all characters.
- int len = p1 - p0;
- char[] buffer = new char[len];
- for (int index = 0; index < len; ++index)
- buffer[index] = ch;
-
- // 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);
+ // Draw echo character using drawEchoCharacter() method.
+ for (int index = p0; index < p1; ++index)
+ x = drawEchoCharacter(g, x, y, ch);
+ return x;
}
/**
* Draws unselected text at a given position.
*
* @param g the <code>Graphics</code> object to draw to
- * @param x the x-position
- * @param y the y-position
+ * @param x the x-position of the start of the baseline
+ * @param y the y-position of the start of the baseline
* @param p0 the position of the first character to draw
* @param p1 the position of the first character not to draw
*
@@ -146,35 +137,20 @@ public class PasswordView
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- // FIXME: Throw BadLocationException somehow.
-
// Update font metrics.
updateMetrics();
// 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.
- 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));
+ // Draw echo character using drawEchoCharacter() method.
+ for (int index = p0; index < p1; ++index)
+ x = drawEchoCharacter(g, x, y, ch);
+ return x;
}
/**
OpenPOWER on IntegriCloud