Class 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.
      • 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

      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • field

        private javax.swing.JPasswordField field
        The associated password field.
    • Constructor Detail

      • RadiancePasswordView

        private RadiancePasswordView​(javax.swing.JPasswordField field,
                                     javax.swing.text.Element element)
        Simple constructor.
        Parameters:
        field - The associated password field.
        element - The element
    • 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 by RadianceSynapse.PASSWORD_ECHO_PER_CHAR client property.
        Parameters:
        g - Graphics context
        x - 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. The RadianceSynapse.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 class javax.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 class javax.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 class javax.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 class javax.swing.text.FieldView
      • getPreferredSpan

        public float getPreferredSpan​(int axis)
        Overrides:
        getPreferredSpan in class javax.swing.text.FieldView