public class EchoTextScanner extends TextScanner
EchoTextScanner class scans text to lay out text, to draw
text, and to compute the position of text. Each character in the text is
treated as the specified echo character. The EchoTextScanner
class is useful when the user input shouldn't be echoed to the screen,
as in the case of a password field.| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected char[] |
echoChars
The array of echo characters.
|
protected int |
echoCharWidth
The width of a echo character.
|
ATTACHMENT, attachments, baseline, CHAR_NOT_IN_FONT, CROSSED_X, destX, END_OF_RUN, IGNORE, JAVA_BREAK_STOPS, JAVA_STOPS, lastCondition, lastIndex, leftMargin, LINE_BREAK, LINE_SEPARATOR, lineBegin, lineEnd, lineHeight, lineWrap, LIST_STOPS, locale, metrics, NO_STOPS, notInFontChar, notInFontCharString, notInFontCharWidth, richTextStyle, rightMargin, runEnd, SIMPLE_STOPS, TAB, tabWidth, text, widths| コンストラクタと説明 |
|---|
EchoTextScanner(RichText richText,
int lineWrap,
char echoChar,
java.util.Locale locale)
Constructs a echo text scanner with the rich text to be scanned,
the line wrapping style, the echo character, and the locale of
the text.
|
EchoTextScanner(Text text,
RichTextStyle richTextStyle,
int lineWrap,
char echoChar,
java.util.Locale locale)
Constructs a echo text scanner with the text to be scanned, the
rich text style, the line wrapping style, the echo character, and
the locale of the text.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
int |
charWidth(char ch)
Returns the advance width of the specified character in the text.
|
int |
charWidthAt(int textIndex,
int startX,
int layoutWidth,
TextLineInfo lineInfo,
ParagraphStyle pStyle)
Returns the advance width of a character in the specified index of text
with the specified scanning context.
|
protected int |
doDrawLineStop(int stop,
java.awt.Graphics g,
java.awt.Point offset,
int drawY,
int rStart,
int rEnd,
TextStyle tStyle)
Handles the stop condition for drawing a line.
|
protected int |
doLayoutLineStop(int stop)
Handles the stop condition for breaking text into a line.
|
protected int |
doTextPositionStop(int stop)
Handles the stop condition for computing a position of character.
|
void |
drawLineFromTo(java.awt.Graphics g,
java.awt.Point offset,
int startX,
int beginIndex,
int endIndex,
int lineHeight,
int baseline,
int leftMgn,
int tabW,
int[] stops)
Draws a line from the beginning index to the ending index of text.
|
protected int |
scanChars(int begin,
int end,
char[] chars,
int rightX,
int[] stops)
Scans the array of characters and returns the stop condition
if the scanning runs to the
end, the scanning runs
across the rightX, or the scanning encounters the
stop condition defined in the stops. |
protected void |
setFontMetrics(java.awt.FontMetrics metrics)
Sets the font metrics.
|
charWidth, doLayoutLine, doLayoutLine, doLayoutLine, doLayoutLine, drawLine, drawLineFromTo, drawLineFromTo, drawLineFromTo, drawLineTo, drawLineTo, fastScanChars, fastScanCharsForMultiBytes, getStops, linePositionAt, linePositionAt, linePositionAt, linePositionAt, nextTab, prevTab, setLineWrap, setNotInFontChar, slowScanCharsprotected char[] echoChars
protected int echoCharWidth
public EchoTextScanner(RichText richText, int lineWrap, char echoChar, java.util.Locale locale)
richText - the rich text to be scanned.lineWrap - the line wrapping style.echoChar - the echo character.locale - the locale of the text.public EchoTextScanner(Text text, RichTextStyle richTextStyle, int lineWrap, char echoChar, java.util.Locale locale)
text - the text to be scanned.richTextStyle - the rich text style.lineWrap - the line wrapping style.echoChar - the echo character.locale - the locale of the text.public void drawLineFromTo(java.awt.Graphics g,
java.awt.Point offset,
int startX,
int beginIndex,
int endIndex,
int lineHeight,
int baseline,
int leftMgn,
int tabW,
int[] stops)
drawLineFromTo クラス内 TextScannerg - the graphics.offset - the offset position to draw.startX - the starting x position to draw.beginIndex - the beginning index of text to draw. (inclusive)endIndex - the ending index of text to draw. (exclusive)lineHeight - the height of a line.baseline - the baseline of a line.leftMgn - the left margin of a line.tabW - the tab width used to scan.stops - the stop conditions for scanning.public int charWidth(char ch)
charWidth クラス内 TextScannerch - the character to be measured.public int charWidthAt(int textIndex,
int startX,
int layoutWidth,
TextLineInfo lineInfo,
ParagraphStyle pStyle)
charWidthAt クラス内 TextScannertextIndex - the index of a character to be measured.startX - the starting x position to scan.layoutWidth - the composition width.lineInfo - the information of a line where a character is in.pStyle - the paragraph style of a line.protected int doLayoutLineStop(int stop)
doLayoutLineStop クラス内 TextScannerstop - the stop condition.-1 if the scanning runs to the end;
1 if the scanning runs across the right edge.protected int doDrawLineStop(int stop,
java.awt.Graphics g,
java.awt.Point offset,
int drawY,
int rStart,
int rEnd,
TextStyle tStyle)
doDrawLineStop クラス内 TextScannerstop - the stop condition.g - the graphics.offset - the offset position to draw.drawY - the current y position.rStart - the run start index.rEnd - the run end index.tStyle - the current text style.-1 if the scanning runs to the end.protected int doTextPositionStop(int stop)
doTextPositionStop クラス内 TextScannerstop - the stop condition.-1 if the scanning runs to the end;
1 if the scanning runs across the right edge or
the scanning encounters a line separator or a line break.protected int scanChars(int begin,
int end,
char[] chars,
int rightX,
int[] stops)
end, the scanning runs
across the rightX, or the scanning encounters the
stop condition defined in the stops.scanChars クラス内 TextScannerbegin - the beginning index of scanning. (inclusive)end - the ending index of scanning. (exclusive)chars - the array of characters to be scanned.rightX - the right edge for scanning.stops - the stop conditions for scanning.protected void setFontMetrics(java.awt.FontMetrics metrics)
setFontMetrics クラス内 TextScannermetrics - the font metrics.