bb.gui
Class TextFieldSecure.CaretSecure

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.Rectangle
              extended by javax.swing.text.DefaultCaret
                  extended by bb.gui.TextFieldSecure.CaretSecure
All Implemented Interfaces:
FocusListener, MouseListener, MouseMotionListener, Shape, Serializable, Cloneable, EventListener, Caret
Enclosing class:
TextFieldSecure

private static class TextFieldSecure.CaretSecure
extends DefaultCaret

Subclass of DefaultCaret which is designed for high security. This class has a permanently invisible caret, so it never indicates the length of text being entered.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.text.DefaultCaret
ALWAYS_UPDATE, changeEvent, listenerList, NEVER_UPDATE, UPDATE_WHEN_ON_EDT
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
private TextFieldSecure.CaretSecure()
          Constructor.
 
Method Summary
private static FocusListener makeFocusListener(JTextComponent textComponent)
          Because this instance's caret is invisible, it is important to give the user some visual cue when the JTextComponent it is part of has keyboard focus.
 void paint(Graphics g)
          Draws nothing, effectively making the caret invisible.
 
Methods inherited from class javax.swing.text.DefaultCaret
addChangeListener, adjustVisibility, damage, deinstall, equals, fireStateChanged, focusGained, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getSelectionPainter, getUpdatePolicy, install, isActive, isSelectionVisible, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, moveCaret, moveDot, moveDot, positionCaret, removeChangeListener, repaint, setBlinkRate, setDot, setDot, setMagicCaretPosition, setSelectionVisible, setUpdatePolicy, setVisible, toString
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

TextFieldSecure.CaretSecure

private TextFieldSecure.CaretSecure()
Constructor.

Method Detail

paint

public void paint(Graphics g)
           throws IllegalStateException
Draws nothing, effectively making the caret invisible.

Specified by:
paint in interface Caret
Overrides:
paint in class DefaultCaret
Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread

makeFocusListener

private static FocusListener makeFocusListener(JTextComponent textComponent)
                                        throws IllegalStateException
Because this instance's caret is invisible, it is important to give the user some visual cue when the JTextComponent it is part of has keyboard focus. This method creates a FocusListener which indicates when textComponent has keyboard focus by setting its background color to white, and setting its background color to light red when it lacks keyboard focus.

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread