|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
javax.swing.JPasswordField
bb.gui.TextFieldSecure
public class TextFieldSecure
Subclass of JPasswordField
which fixes defects in its superclass to offer superior security.
For top security, it is critical that:
TextFieldSecure.CaretSecure
instance.
TextFieldSecure.DocumentSecure
and TextFieldSecure.ContentSecure
classes to achieve this.
TextFieldSecure.ContentSecure
classes to prevent this.
Like typical Java GUI code, this class is not multithread safe:
it expects to only be called by EventQueue
's dispatch thread
.
This threading limitation is checked in every public method.
Nested Class Summary | |
---|---|
private static class |
TextFieldSecure.CaretSecure
Subclass of DefaultCaret which is designed for high security. |
private static class |
TextFieldSecure.ContentSecure
Subclass of GapContent which is designed for high security. |
private static class |
TextFieldSecure.DocumentSecure
Subclass of DocumentLimitedLength which is designed for high security. |
Nested classes/interfaces inherited from class javax.swing.JPasswordField |
---|
JPasswordField.AccessibleJPasswordField |
Nested classes/interfaces inherited from class javax.swing.JTextField |
---|
JTextField.AccessibleJTextField |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private static long |
serialVersionUID
|
Fields inherited from class javax.swing.JTextField |
---|
notifyAction |
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TextFieldSecure(int numberCharsMax)
Constructs a new TextFieldSecure instance. |
Method Summary | |
---|---|
TextFieldSecure.DocumentSecure |
getDocumentSecure()
Returns the Document used by this instance, which is always a TextFieldSecure.DocumentSecure instance. |
char[] |
getInput()
Returns a char[] of the chars currently in this instance. |
int |
getNumberCharsMax()
Returns the maximum number of chars that may be typed in this instance. |
private void |
readObject(ObjectInputStream ois)
Customizes deserialization. |
void |
zeroOutInput()
Calls
|
Methods inherited from class javax.swing.JPasswordField |
---|
copy, cut, echoCharIsSet, getAccessibleContext, getEchoChar, getPassword, getText, getText, getUIClassID, paramString, setEchoChar, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
Constructor Detail |
---|
public TextFieldSecure(int numberCharsMax) throws IllegalArgumentException, IllegalStateException
numberCharsMax
- the maximum number of chars that may be typed in this instance
as well as its number of columns (this affects its displayed width); must be > 0
IllegalArgumentException
- if numberCharsMax <= 0
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
Method Detail |
---|
public TextFieldSecure.DocumentSecure getDocumentSecure() throws IllegalStateException
TextFieldSecure.DocumentSecure
instance.
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
public int getNumberCharsMax() throws IllegalStateException
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
public char[] getInput() throws IllegalStateException
getPassword
.
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
public void zeroOutInput() throws IllegalStateException
getDocumentSecure
.zeroOutContent()
.
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException, NotActiveException
ClassNotFoundException
- if the class of a serialized object could not be found
IOException
- if an I/O problem occurs
NotActiveException
- if the stream is not currently reading objects
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |