javax.swing.text
Class PasswordView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.PlainView
          extended by javax.swing.text.FieldView
              extended by javax.swing.text.PasswordView
All Implemented Interfaces:
SwingConstants, TabExpander

public class PasswordView
extends FieldView


Field Summary
 
Fields inherited from class javax.swing.text.PlainView
metrics
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
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
 
Constructor Summary
PasswordView(Element elem)
           
 
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.FieldView
adjustAllocation, changedUpdate, getFontMetrics, getResizeWeight, insertUpdate, paint, removeUpdate
 
Methods inherited from class javax.swing.text.PlainView
damageLineRange, drawLine, getLineBuffer, getTabSize, lineToRect, nextTabStop, updateDamage, updateMetrics
 
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
 

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)
                        throws BadLocationException
Draws selected text at a given position.

Overrides:
drawSelectedText in class PlainView
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
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 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
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 >= 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.

Overrides:
viewToModel in class FieldView
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