Behaviour
The field shows a label followed by the text of the currently selected
choice. When this field has the focus, the text of the currently selected
choice is shown inverted.
By default, ChoiceField behaves as if the Field.USE_ALL_WIDTH style
was set, with the label on the leading edge of the line and the choice on
the trailing edge, separated by any available space. Setting the
Field.FIELD_LEFT, Field.FIELD_RIGHT, or
Field.FIELD_HCENTER style will cause the label and choice to be
joined together with no space in between.
If the choice field is created with the Field.EDITABLE style (it is
by default), then the user may alter the currently selected choice when the
field has the focus. The selection wraps around, so when the end of the list
of choices is reached, selection is set to the other end.

Methods of selecting a choice
Pressing the space bar moves the selection to the next choice in the list.

You can use the trackwheel to change the selection by holding the ALT key
down while rolling. If Ui.getIncreaseDirection() is -1, then
ALT-rolling the trackwheel down should move through selections in an
increasing manner. If Ui.getIncreaseDirection() is +1, the ALT-rolling
the trackwheel up should move through selections in an increasing manner.

Character presses will jump to the first letter of the next item starting
with the character, regardless of case.

Finally, the field adds a menu item added to change its selected
value. When the use selects this menu item, a dialog appears allowing the
user to employ the trackwheel to select a new value without holding the ALT
key. Pressing ENTER or clicking dismisses this dialog and changes the
choice. Pressing ESCAPE dismisses the dialog and cancels the change. Other
keys will work as defined above.

CONTEXT_CHANGE_OPTION

public static final int CONTEXT_CHANGE_OPTION

Context hint for the event being triggered from a change option dialog
dismissal.
This value is sent to the FieldChangeListener on a fieldChanged event if
the user changed an option using touch screen, trackpad or by pressing a key.

toString

Returns a string representation of the object. In general, the
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.

The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:

true if the action was consumed or false
if the action was not consumed.

Since:

BlackBerry API 4.2.0

keyChar

protected boolean keyChar(char key,
int status,
int time)

Traps key events to seek to appropriate choice.

This method handles and consumes a key generation event, only if this
field is EDITABLE; otherwise, it does nothing and
does not consume the event.

If the key generated was a SPACE character, this method moves the
selection to the next choice in the list. If the previous selection was
the last in the list, the selection wraps around to the first value in
the list.

If the key generated was a letter key, this method moves the
selection to the first subsequent value that begins with the generated
letter. If there are no matches before the end of the list, the search
wraps around. If there are no matches anywhere in the list, the selection
does not move (but this method still consumes the key event).

If the selection does move, this field is invalidated to force a
repaint.

touchEvent

This method handles touch input events. DOWN events cause this ChoiceField
to enter a focused state, which is in fact handled at the Manager level. CLICK and
UNCLICK events occurring out of bounds are consumed and ignored.

setSelectedIndex

Provide this method with an object, and it sets the selection on the
first value in this field's list (starting from the first item) that
matches this object (using Object.equals(java.lang.Object)). If a match is not
found, this method does not alter the current the selection.

Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.Java is a trademark of Oracle America Inc. in the US and other countries.Legal