com.retek.commons.gui.widget
Class RPasswordField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.text.JTextComponent
                  extended byjavax.swing.JTextField
                      extended byjavax.swing.JPasswordField
                          extended bycom.retek.commons.gui.widget.RPasswordField
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable, javax.swing.SwingConstants, WidgetInterface

public class RPasswordField
extends javax.swing.JPasswordField
implements java.awt.event.KeyListener, WidgetInterface

This class sub-classes JPasswordField in order to supply additional functionality.

Retek Inc. Copyright (c) 2002

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPasswordField
javax.swing.JPasswordField.AccessibleJPasswordField
 
Nested classes inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
RPasswordField()
          Returns a new RTextField object.
 
Method Summary
 void clear()
          Clears the password field of input.
 java.lang.String getClusterName()
          Retrieves the cluster name of the widget.
 boolean isErrorState()
          Retrieves whether or not the password field is in an error state.
 void keyPressed(java.awt.event.KeyEvent event)
          Implements the key listener interface "key pressed" method.
 void keyReleased(java.awt.event.KeyEvent event)
          Implements the key listener interface "key released" method.
 void keyTyped(java.awt.event.KeyEvent event)
          Implements the key listener interface "key typed" method.
 void setBackground(java.awt.Color color)
           
 void setClusterName(java.lang.String clusterName)
          Sets the cluster name of the widget.
 void setDefaultSize(int width, int height, int length)
          Sets the minimum and preferred width and height of the password field as well as the number of characters allowed in the field.
 void setEnabled(boolean enabled)
          Overrides the superclass method in order to not only set the enabled state, but also update the color state of the password field.
 void setErrorState(boolean errorState)
          Sets the colors of the password field to an error state.
 void setFocusedState()
          Sets the password field to focused state, updating colors.
 void setForeground(java.awt.Color color)
           
 void setLength(int textLength)
          Sets the allowable text length.
 void setMinimumSize(int width, int height)
          Sets the minimum and preferred width and height of the password field.
 void setMinimumWidth(int width)
          Sets the minimum and preferred width of the password field.
 void setText(java.lang.String text)
          Assigns the text in the field.
 void updateColorState()
          Updates the color state.
 
Methods inherited from class javax.swing.JPasswordField
copy, cut, echoCharIsSet, getAccessibleContext, getEchoChar, getPassword, getText, getText, getUIClassID, paramString, setEchoChar
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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
 
Methods inherited from interface com.retek.commons.gui.core.WidgetInterface
getName, setName
 

Constructor Detail

RPasswordField

public RPasswordField()
Returns a new RTextField object.

Method Detail

setMinimumWidth

public void setMinimumWidth(int width)
Sets the minimum and preferred width of the password field. This method uses the default line height value to determine the minimum and preferred height.

Parameters:
width - The width in pixels.

setMinimumSize

public void setMinimumSize(int width,
                           int height)
Sets the minimum and preferred width and height of the password field.

Parameters:
width - The width in pixels.
height - The height in pixels.

setDefaultSize

public void setDefaultSize(int width,
                           int height,
                           int length)
Sets the minimum and preferred width and height of the password field as well as the number of characters allowed in the field.

Parameters:
width - The width in pixels.
height - The height in pixels.
length - The length in characters that the text field should allow.

setLength

public void setLength(int textLength)
Sets the allowable text length. The password field will only allow users to enter up to this length in characters before it stops processing keystrokes.


setEnabled

public void setEnabled(boolean enabled)
Overrides the superclass method in order to not only set the enabled state, but also update the color state of the password field.

Parameters:
enabled - True if the field should be enabled, false if it should be disabled.

setText

public void setText(java.lang.String text)
Assigns the text in the field. Text longer than the allowed length is not allowed.

Parameters:
text - The text to place in the password field.

clear

public void clear()
Clears the password field of input.


keyReleased

public void keyReleased(java.awt.event.KeyEvent event)
Implements the key listener interface "key released" method. This empty implementation exists to fulfill the requirements of the listener.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

keyPressed

public void keyPressed(java.awt.event.KeyEvent event)
Implements the key listener interface "key pressed" method. The method tracks whether or not the key pressed was the backspace or delete key. In addition, if the ENTER key is pressed, it transfers the focus to the next focusable field.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

keyTyped

public void keyTyped(java.awt.event.KeyEvent event)
Implements the key listener interface "key typed" method. It captures the key typed action, checks to see if the allowable length is reached and if the key is not a backspace/delete/left arrow key, then the key is ignored.

If the text in the field is selected, a new keystroke would replace the selected text and by default that means we cannot

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
event - Details about the key event that occurred.

setClusterName

public void setClusterName(java.lang.String clusterName)
Sets the cluster name of the widget. A cluster name associates a group of widgets.

Specified by:
setClusterName in interface WidgetInterface
Parameters:
clusterName - The cluster name to assign to the widget.

getClusterName

public java.lang.String getClusterName()
Retrieves the cluster name of the widget.

Specified by:
getClusterName in interface WidgetInterface

setBackground

public void setBackground(java.awt.Color color)
See Also:
in JTextField.

setForeground

public void setForeground(java.awt.Color color)
See Also:
in JTextField.

setErrorState

public void setErrorState(boolean errorState)
Sets the colors of the password field to an error state. This will also grab the focus and select all the text in the feild if the password field is locked.

Specified by:
setErrorState in interface WidgetInterface

isErrorState

public boolean isErrorState()
Retrieves whether or not the password field is in an error state.

Specified by:
isErrorState in interface WidgetInterface
Returns:
True if the password field is in an error state, false if not

setFocusedState

public void setFocusedState()
Sets the password field to focused state, updating colors.

Specified by:
setFocusedState in interface WidgetInterface

updateColorState

public void updateColorState()
Updates the color state. This method ensures the color displayed by the widget is correct based on the state of the widget. The controlling color flag is to keep the set() methods from changing the default background color.



Copyright © 2005 Retek Inc. All Rights Reserved. - Generated at Fri, 01/21/2005 14:25