com.isti.util.gui
Class IstiPasswordPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.isti.util.gui.IstiPasswordPanel
All Implemented Interfaces:
PasswordAuthenticator, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class IstiPasswordPanel
extends javax.swing.JPanel
implements PasswordAuthenticator

Class IstiPasswordPanel defines a password panel.

See Also:
Serialized Form

Nested Class Summary
protected  class IstiPasswordPanel.UpdateListener
          Update listener class.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.util.Vector listenerList
           
static java.lang.String LOGIN_DIALOG_CANCEL_OPTION_STRING
          Login dialog cancel option string.
static java.lang.String LOGIN_DIALOG_DEFAULT_OPTION_STRING
          Login dialog default option string.
static java.lang.String LOGIN_DIALOG_DEFAULT_TITLE_STRING
          Login dialog default title string.
protected  MultiLineJLabel panelPromptTextObj
           
protected  javax.swing.JPasswordField passwordField
           
protected  javax.swing.JLabel passwordLabel
           
static int USERNAME_COLUMNS
          The default number of characters in the username field.
static java.lang.String USERNAME_NOT_ALLOWED_CHARS
          The default for not allowed characters in the username field.
protected  javax.swing.JTextField usernameField
           
protected  javax.swing.JLabel usernameLabel
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
  IstiPasswordPanel()
          Creates a password panel.
  IstiPasswordPanel(int columns)
          Creates a password panel.
  IstiPasswordPanel(int columns, java.lang.String notAllowedChars)
          Creates a password panel with restricted character input for the username.
protected IstiPasswordPanel(javax.swing.JTextField usernameField)
          Creates a password panel.
  IstiPasswordPanel(java.lang.String panelPromptStr)
          Creates a password panel.
  IstiPasswordPanel(java.lang.String panelPromptStr, int columns)
          Creates a password panel.
  IstiPasswordPanel(java.lang.String panelPromptStr, int columns, java.lang.String notAllowedChars)
          Creates a password panel with restricted character input for the username.
protected IstiPasswordPanel(java.lang.String panelPromptStr, javax.swing.JTextField usernameField)
          Creates a password panel.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds an ActionListener to the panel.
static IstiDialogPopup createLoginDialog(java.awt.Component parentComp)
           
static IstiDialogPopup createLoginDialog(java.awt.Component parentComp, java.lang.Object msgObj)
           
static IstiDialogPopup createLoginDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr)
           
static IstiDialogPopup createLoginDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, java.lang.Object optionObj)
           
static IstiPasswordPanel createPasswordPanel()
          Creates a password panel.
static IstiPasswordPanel createPasswordPanel(java.lang.String panelPromptStr)
          Creates a password panel.
static IstiPasswordPanel createRestrictedPasswordPanel()
          Creates a password panel with restricted character input for the username.
static IstiPasswordPanel createRestrictedPasswordPanel(java.lang.String panelPromptStr)
          Creates a password panel with restricted character input for the username.
protected  void fireActionPerformed(java.awt.event.ActionEvent event)
          Notifies all listeners that have registered interest for notification on this event type.
 java.lang.String getPassword()
          Returns the password text and clear the password characters.
 java.net.PasswordAuthentication getPasswordAuthentication()
          Get the password authentication.
 char[] getPasswordChars()
          Returns the password characters.
 java.lang.String getUsername()
          Returns the username text.
 javax.swing.JTextField getUsernameFieldObj()
          Returns the 'JTextField' object for the username.
 void removeActionListener(java.awt.event.ActionListener l)
          Removes an ActionListener from the panel.
 void setInitialFocus()
          Requests that the current "initial" component have the keyboard focus.
 void setPassword(java.lang.String passwordText)
          Sets the password text.
 void setUsername(java.lang.String usernameText)
          Sets the username text.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

usernameLabel

protected final javax.swing.JLabel usernameLabel

usernameField

protected final javax.swing.JTextField usernameField

passwordLabel

protected final javax.swing.JLabel passwordLabel

passwordField

protected final javax.swing.JPasswordField passwordField

panelPromptTextObj

protected final MultiLineJLabel panelPromptTextObj

listenerList

protected final java.util.Vector listenerList

LOGIN_DIALOG_DEFAULT_TITLE_STRING

public static java.lang.String LOGIN_DIALOG_DEFAULT_TITLE_STRING
Login dialog default title string.


LOGIN_DIALOG_DEFAULT_OPTION_STRING

public static java.lang.String LOGIN_DIALOG_DEFAULT_OPTION_STRING
Login dialog default option string.


LOGIN_DIALOG_CANCEL_OPTION_STRING

public static java.lang.String LOGIN_DIALOG_CANCEL_OPTION_STRING
Login dialog cancel option string.


USERNAME_COLUMNS

public static final int USERNAME_COLUMNS
The default number of characters in the username field.

See Also:
Constant Field Values

USERNAME_NOT_ALLOWED_CHARS

public static final java.lang.String USERNAME_NOT_ALLOWED_CHARS
The default for not allowed characters in the username field.

See Also:
Constant Field Values
Constructor Detail

IstiPasswordPanel

public IstiPasswordPanel()
Creates a password panel.

See Also:
createPasswordPanel

IstiPasswordPanel

public IstiPasswordPanel(java.lang.String panelPromptStr)
Creates a password panel.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
See Also:
createPasswordPanel

IstiPasswordPanel

public IstiPasswordPanel(int columns)
Creates a password panel.

Parameters:
columns - the number of the columns for the username field.

IstiPasswordPanel

public IstiPasswordPanel(java.lang.String panelPromptStr,
                         int columns)
Creates a password panel.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
columns - the number of the columns for the username field.

IstiPasswordPanel

public IstiPasswordPanel(int columns,
                         java.lang.String notAllowedChars)
Creates a password panel with restricted character input for the username.

Parameters:
columns - the number of the columns for the field.
notAllowedChars - a String of characters not allowed to be entered into the username field.
See Also:
createRestrictedPasswordPanel, USERNAME_COLUMNS, USERNAME_NOT_ALLOWED_CHARS

IstiPasswordPanel

public IstiPasswordPanel(java.lang.String panelPromptStr,
                         int columns,
                         java.lang.String notAllowedChars)
Creates a password panel with restricted character input for the username.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
columns - the number of the columns for the field.
notAllowedChars - a String of characters not allowed to be entered into the username field.
See Also:
createRestrictedPasswordPanel, USERNAME_COLUMNS, USERNAME_NOT_ALLOWED_CHARS

IstiPasswordPanel

protected IstiPasswordPanel(javax.swing.JTextField usernameField)
Creates a password panel.

Parameters:
usernameField - the username text field.

IstiPasswordPanel

protected IstiPasswordPanel(java.lang.String panelPromptStr,
                            javax.swing.JTextField usernameField)
Creates a password panel.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
usernameField - the username text field.
Method Detail

setInitialFocus

public void setInitialFocus()
Requests that the current "initial" component have the keyboard focus.


getPassword

public java.lang.String getPassword()
Returns the password text and clear the password characters.

Returns:
the password text.

getPasswordAuthentication

public java.net.PasswordAuthentication getPasswordAuthentication()
Get the password authentication.

Specified by:
getPasswordAuthentication in interface PasswordAuthenticator
Returns:
the password authentication or null if none.

getPasswordChars

public char[] getPasswordChars()
Returns the password characters. For stronger security, it is recommended that the returned character array be cleared after use by setting each character to zero.

Returns:
the password characters.

setPassword

public void setPassword(java.lang.String passwordText)
Sets the password text.

Parameters:
passwordText - password text to use.

getUsername

public java.lang.String getUsername()
Returns the username text.

Returns:
the username text.

setUsername

public void setUsername(java.lang.String usernameText)
Sets the username text.

Parameters:
usernameText - username text to use.

getUsernameFieldObj

public javax.swing.JTextField getUsernameFieldObj()
Returns the 'JTextField' object for the username.

Returns:
The 'JTextField' object for the username.

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds an ActionListener to the panel.

Parameters:
l - the ActionListener to be added.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the panel. If the listener is the currently set Action for the panel, then the Action is set to null.

Parameters:
l - the listener to be removed.

fireActionPerformed

protected void fireActionPerformed(java.awt.event.ActionEvent event)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
event - the ChangeEvent object
See Also:
EventListenerList

createPasswordPanel

public static IstiPasswordPanel createPasswordPanel()
Creates a password panel.

Returns:
a new password panel object.

createPasswordPanel

public static IstiPasswordPanel createPasswordPanel(java.lang.String panelPromptStr)
Creates a password panel.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
Returns:
a new password panel object.

createRestrictedPasswordPanel

public static IstiPasswordPanel createRestrictedPasswordPanel()
Creates a password panel with restricted character input for the username.

Returns:
a new password panel object with restricted character input for the username.

createRestrictedPasswordPanel

public static IstiPasswordPanel createRestrictedPasswordPanel(java.lang.String panelPromptStr)
Creates a password panel with restricted character input for the username.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
Returns:
a new password panel object with restricted character input for the username.

createLoginDialog

public static IstiDialogPopup createLoginDialog(java.awt.Component parentComp)
Parameters:
parentComp - the parent component for the popup.
Returns:
login dialog

createLoginDialog

public static IstiDialogPopup createLoginDialog(java.awt.Component parentComp,
                                                java.lang.Object msgObj)
Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
Returns:
login dialog

createLoginDialog

public static IstiDialogPopup createLoginDialog(java.awt.Component parentComp,
                                                java.lang.Object msgObj,
                                                java.lang.String titleStr)
Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
Returns:
login dialog

createLoginDialog

public static IstiDialogPopup createLoginDialog(java.awt.Component parentComp,
                                                java.lang.Object msgObj,
                                                java.lang.String titleStr,
                                                java.lang.Object optionObj)
Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionObj - the Object that defines the button, or null to display no buttons.
Returns:
login dialog