javax.swing.text
Class PasswordView
java.lang.Object
javax.swing.text.View
javax.swing.text.PlainView
javax.swing.text.FieldView
javax.swing.text.PasswordView
- All Implemented Interfaces:
- SwingConstants, TabExpander
public class PasswordView
- extends FieldView
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Method Summary |
protected int |
drawEchoCharacter(Graphics g,
int x,
int y,
char ch)
Draws one echo character at a given position. |
protected int |
drawSelectedText(Graphics g,
int x,
int y,
int p0,
int p1)
Draws selected text at a given position. |
protected int |
drawUnselectedText(Graphics g,
int x,
int y,
int p0,
int p1)
Draws unselected text at a given position. |
float |
getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. |
Shape |
modelToView(int pos,
Shape a,
Position.Bias b)
Provides a mapping from the document model coordinate space to the
coordinate space of the view mapped to it. |
int |
viewToModel(float fx,
float fy,
Shape a,
Position.Bias[] bias)
Provides a mapping from the view coordinate space to the logical
coordinate space of the model. |
Methods inherited from class javax.swing.text.View |
append, breakView, createFragment, dump, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PasswordView
public PasswordView(Element elem)
drawEchoCharacter
protected int drawEchoCharacter(Graphics g,
int x,
int y,
char ch)
- Draws one echo character at a given position.
- Parameters:
g
- the Graphics
object to draw tox
- the x-positiony
- the y-positionch
- the echo character
- Returns:
- the next x position right of the drawn character
drawSelectedText
protected int drawSelectedText(Graphics g,
int x,
int y,
int p0,
int p1)
throws BadLocationException
- Draws selected text at a given position.
- Overrides:
drawSelectedText
in class PlainView
- Parameters:
g
- the Graphics
object to draw tox
- the x-positiony
- the y-positionp0
- the position of the first character to drawp1
- the position of the first character not to draw
- Returns:
- the next x position right of the drawn character
- Throws:
BadLocationException
drawUnselectedText
protected int drawUnselectedText(Graphics g,
int x,
int y,
int p0,
int p1)
throws BadLocationException
- Draws unselected text at a given position.
- Overrides:
drawUnselectedText
in class PlainView
- Parameters:
g
- the Graphics
object to draw tox
- the x-position of the start of the baseliney
- the y-position of the start of the baselinep0
- the position of the first character to drawp1
- the position of the first character not to draw
- Returns:
- the next x position right of the drawn character
- Throws:
BadLocationException
- if p0
or p1
are
invalid
getPreferredSpan
public float getPreferredSpan(int axis)
- Determines the preferred span for this view along an axis.
- Overrides:
getPreferredSpan
in class FieldView
- Parameters:
axis
- to get the preferred span of
- Returns:
- the preferred span of the axis
modelToView
public Shape modelToView(int pos,
Shape a,
Position.Bias b)
throws BadLocationException
- Provides a mapping from the document model coordinate space to the
coordinate space of the view mapped to it.
This method is overridden to provide a correct mapping with respect to the
echo char and not to the real content.
- Overrides:
modelToView
in class FieldView
- Parameters:
pos
- - the position to convert >= 0a
- - the allocated region to render intob
- - typesafe enumeration to indicate bias to a position in the model.
- Returns:
- the bounding box of the given position
- Throws:
BadLocationException
- if the given position does not
represent a valid location in the associated document
viewToModel
public int viewToModel(float fx,
float fy,
Shape a,
Position.Bias[] bias)
- Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
- Overrides:
viewToModel
in class FieldView
- Parameters:
fx
- - the X coordinate >= 0.0ffy
- - the Y coordinate >= 0.0fa
- - the allocated region to render intobias
- - typesafe enumeration to indicate bias to a position in the model.
- Returns:
- the location within the model that best represents
the given point in the view