net.rim.device.api.ui.component
Class PasswordEditField

java.lang.Object
  |
  +--net.rim.device.api.ui.Field
        |
        +--net.rim.device.api.ui.component.TextField
              |
              +--net.rim.device.api.ui.component.BasicEditField
                    |
                    +--net.rim.device.api.ui.component.PasswordEditField
All Implemented Interfaces:
IComponent, InputMethodListener, InputMethodRequests

public class PasswordEditField
extends BasicEditField

An editable text field desgined specifically to handle password input.

Behaviour
This field maintains a private real text buffer which it uses to store the password in clear text. The visible value this field shows to the user is a string of asterisks equal in length to the real text buffer.

This field does not have any automatic input replacement, so the typed text is exactly what is typed. AutoCaps, AutoText, AutoPeriod, and any other transformation are turned off. Also, holding a key and rolling the wheel is not allowed.

This field does not support copy or cut operations.

By default, this field supports all the available characters. You can restrict this by applying a TextFilter.


Fields inherited from class net.rim.device.api.ui.component.BasicEditField
CONSUME_INPUT, DEFAULT_MAXCHARS, FILTER_DEFAULT, FILTER_EMAIL, FILTER_HEXADECIMAL, FILTER_INTEGER, FILTER_LOWERCASE, FILTER_NUMERIC, FILTER_PHONE, FILTER_PIN_ADDRESS, FILTER_REAL_NUMERIC, FILTER_UPPERCASE, FILTER_URL, JUMP_FOCUS_AT_END, NO_COMPLEX_INPUT, NO_LEARNING, NO_NEWLINE
 
Fields inherited from class net.rim.device.api.ui.Field
EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, READONLY, USE_ALL_HEIGHT, USE_ALL_WIDTH
 
Constructor Summary
PasswordEditField()
          Constructs a new PasswordEditField instance.
PasswordEditField(String label, String initialValue)
          Constructs a PasswordEditField instance with label and initial value.
PasswordEditField(String label, String initialValue, int maxNumChars, long style)
          Constructs a smaller PasswordEditField object.
 
Method Summary
 boolean isSelectionCopyable()
          Determines if this field supports copy operations.
protected  boolean keyRepeat(int keycode, int time)
          Consumes key repeat events.
 void selectionCopy(Clipboard cb)
          Does nothing.
protected  void update(int delta)
          Updates this field.
 
Methods inherited from class net.rim.device.api.ui.component.BasicEditField
backspace, backspace, backspace, charAt, clear, displayFieldFullMessage, drawFocus, getCursorPosition, getFilter, getFocusRect, getLabel, getLabelLength, getMaxSize, getPreferredHeight, getPreferredWidth, getText, getText, getText, getTextAbstractString, getTextLength, insert, insert, isPasteable, isSelectable, isSelecting, isSelectionDeleteable, isSymbolScreenAllowed, keyChar, keyControl, keyDown, layout, makeContextMenu, moveFocus, moveFocus, onFocus, onUnfocus, onVisibilityChange, paint, paste, select, selectionDelete, setCursorPosition, setCursorPosition, setFilter, setFont, setLabel, setMaxSize, setPreLayoutInternal, setText, setText, toString, wipe
 
Methods inherited from class net.rim.device.api.ui.Field
drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getChangeListener, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getOriginal, getScreen, getStyle, getTop, getWidth, invalidate, invalidate, isDirty, isEditable, isFocusable, isMuddy, isSelectionCutable, isStyle, isVisible, keyStatus, keyUp, onDisplay, onExposed, onMenuDismissed, onObscured, onUndisplay, selectionCut, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setMuddy, setPosition, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PasswordEditField

public PasswordEditField()
Constructs a new PasswordEditField instance.

This builds a new password edit field with no label and no initial contents.


PasswordEditField

public PasswordEditField(String label,
                         String initialValue)
Constructs a PasswordEditField instance with label and initial value.

This method buidls an editable password field that can hold up to BasicEditField.DEFAULT_MAXCHARS characters.

Note that your provided text does not itself show up in the created field; this method places your text into a private real text buffer, and shows a string of asterisks of the same length to the user.

Parameters:
label - Label for this field.
initialValue - Initial password value for this field.

PasswordEditField

public PasswordEditField(String label,
                         String initialValue,
                         int maxNumChars,
                         long style)
Constructs a smaller PasswordEditField object.

This method builds an editable password field that can hold a number of characters up to the amount you specify.

Note that your provided text does not itself show up in the created field; this method places your text into a private real text buffer, and shows a string of asterisks of the same length to the user.

Parameters:
label - Label for this field.
initialValue - Initial password value for this field.
maxNumChars - Maximum number of characters this field can hold.
style - Style for this field: this value will be combined with the EDITABLE and NO_NEWLINE styles.
Method Detail

selectionCopy

public final void selectionCopy(Clipboard cb)
Does nothing.

This type of field does not support copy operations.

Overrides:
selectionCopy in class net.rim.device.api.ui.component.TextField
Parameters:
cb - Clipboard object.
Since:
JDE 4.0.2

isSelectionCopyable

public final boolean isSelectionCopyable()
Determines if this field supports copy operations.

Overrides:
isSelectionCopyable in class net.rim.device.api.ui.component.TextField
Returns:
False; password edit fields do not support copy operations.

keyRepeat

protected boolean keyRepeat(int keycode,
                            int time)
Consumes key repeat events.

This method consumes all key repeat events, which aren't appropriate for password fields.

Overrides:
keyRepeat in class Field
Parameters:
keycode - Key being repeated (ignored).
time - Number of milliseconds since the device was turned on.
Returns:
True (this method always consumes key repeat events).
Since:
JDE 4.0.2

update

protected void update(int delta)
Updates this field.

This field's manager invokes this method to prompt this field to update itself. When invoked, this field determines the affected region's new line heights, adjusts the master line length array, adjusts the focus, and resizes the field (if necessary).

Overrides:
update in class BasicEditField
Parameters:
delta - Number of characters by which the field has changed, negative or positive (negative means that many characters have been added.)
Since:
JDE 4.0.2


Copyright 1999-2004 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.