javax.swing.text

Class PasswordView

public class PasswordView extends FieldView

Constructor Summary
PasswordView(Element elem)
Method Summary
protected intdrawEchoCharacter(Graphics g, int x, int y, char ch)
Draws one echo character at a given position.
protected intdrawSelectedText(Graphics g, int x, int y, int p0, int p1)
Draws selected text at a given position.
protected intdrawUnselectedText(Graphics g, int x, int y, int p0, int p1)
Draws unselected text at a given position.
floatgetPreferredSpan(int axis)
Determines the preferred span for this view along an axis.
ShapemodelToView(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.
intviewToModel(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.

Constructor Detail

PasswordView

public PasswordView(Element elem)

Method Detail

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 to x the x-position y the y-position ch 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)
Draws selected text at a given position.

Parameters: g the Graphics object to draw to x the x-position y the y-position p0 the position of the first character to draw p1 the position of the first character not to draw

Returns: the next x position right of the drawn character

drawUnselectedText

protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
Draws unselected text at a given position.

Parameters: g the Graphics object to draw to x the x-position of the start of the baseline y the y-position of the start of the baseline p0 the position of the first character to draw p1 the position of the first character not to draw

Returns: the next x position right of the drawn character

getPreferredSpan

public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis.

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)
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.

Parameters: pos - the position to convert >= 0 a - the allocated region to render into b - 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.

Parameters: fx - the X coordinate >= 0.0f fy - the Y coordinate >= 0.0f a - the allocated region to render into bias - 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