Class RadiancePasswordFieldUI.RadiancePasswordView
- java.lang.Object
-
- javax.swing.text.View
-
- javax.swing.text.PlainView
-
- javax.swing.text.FieldView
-
- org.pushingpixels.radiance.theming.internal.ui.RadiancePasswordFieldUI.RadiancePasswordView
-
- All Implemented Interfaces:
javax.swing.SwingConstants
,javax.swing.text.TabExpander
- Enclosing class:
- RadiancePasswordFieldUI
private static class RadiancePasswordFieldUI.RadiancePasswordView extends javax.swing.text.FieldView
Custom password view.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JPasswordField
field
The associated password field.
-
Constructor Summary
Constructors Modifier Constructor Description private
RadiancePasswordView(javax.swing.JPasswordField field, javax.swing.text.Element element)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private float
drawEchoCharacter(java.awt.Graphics g, float x, float y, boolean isSelected)
Draws the echo character(s) for a single password field character.protected float
drawSelectedText(java.awt.Graphics2D g, float x, float y, int p0, int p1)
protected float
drawUnselectedText(java.awt.Graphics2D g, float x, float y, int p0, int p1)
private int
getEchoCharAdvance()
Returns the advance of a single password field character.float
getPreferredSpan(int axis)
java.awt.Shape
modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b)
int
viewToModel(float fx, float fy, java.awt.Shape a, javax.swing.text.Position.Bias[] bias)
-
Methods inherited from class javax.swing.text.FieldView
adjustAllocation, getFontMetrics, getResizeWeight, insertUpdate, paint, removeUpdate
-
Methods inherited from class javax.swing.text.PlainView
changedUpdate, damageLineRange, drawLine, drawLine, drawSelectedText, drawUnselectedText, getLineBuffer, getTabSize, lineToRect, nextTabStop, setSize, updateDamage, updateMetrics
-
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, 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, updateChildren, updateLayout, viewToModel
-
-
-
-
Method Detail
-
drawEchoCharacter
private float drawEchoCharacter(java.awt.Graphics g, float x, float y, boolean isSelected)
Draws the echo character(s) for a single password field character. The number of echo characters is defined byRadianceSynapse.PASSWORD_ECHO_PER_CHAR
client property.- Parameters:
g
- Graphics contextx
- X coordinate of the first echo character to draw.y
- Y coordinate of the first echo character to draw.isSelected
- Indicates whether the password field character is selected.- Returns:
- The X location of the next echo character.
- See Also:
RadianceSynapse.PASSWORD_ECHO_PER_CHAR
-
getEchoCharAdvance
private int getEchoCharAdvance()
Returns the advance of a single password field character. The advance is the pixel distance between first echo characters of consecutive password field characters. TheRadianceSynapse.PASSWORD_ECHO_PER_CHAR
can be used to specify that more than one echo character is used for each password field character.- Returns:
- The advance of a single password field character
-
drawSelectedText
protected float drawSelectedText(java.awt.Graphics2D g, float x, float y, int p0, int p1) throws javax.swing.text.BadLocationException
- Overrides:
drawSelectedText
in classjavax.swing.text.PlainView
- Throws:
javax.swing.text.BadLocationException
-
drawUnselectedText
protected float drawUnselectedText(java.awt.Graphics2D g, float x, float y, int p0, int p1) throws javax.swing.text.BadLocationException
- Overrides:
drawUnselectedText
in classjavax.swing.text.PlainView
- Throws:
javax.swing.text.BadLocationException
-
modelToView
public java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b) throws javax.swing.text.BadLocationException
- Overrides:
modelToView
in classjavax.swing.text.FieldView
- Throws:
javax.swing.text.BadLocationException
-
viewToModel
public int viewToModel(float fx, float fy, java.awt.Shape a, javax.swing.text.Position.Bias[] bias)
- Overrides:
viewToModel
in classjavax.swing.text.FieldView
-
getPreferredSpan
public float getPreferredSpan(int axis)
- Overrides:
getPreferredSpan
in classjavax.swing.text.FieldView
-
-