Name
Choice
Synopsis
Choice
is an interface that contains the methods common to user
interface components that allow the user to choose from several possible alternatives.
This interface is implemented by the full-screen List
control and
by ChoiceGroup
, which is an Item
.
A Choice
can operate in one of three different modes:
- EXCLUSIVE
Only one alternative can be selected. If the user selects one item from the set of offered alternatives, any item already selected is deselected. In this mode, the control behaves as (and is usually rendered to look like) a set of radio buttons.
- MULTIPLE
Any number of alternatives can be selected. Selecting one item from the list has no effect on the selected state of other entries. In this, the control behaves like a collection of check boxes.
- IMPLICIT
This mode is available only with the
List
control. It allows only one item to be selected at any given time and is typically used to create a menu. The difference between this mode andEXCLUSIVE
, apart from the visual differences, lies in the way in which selection changes are notified to application code. See the description of theList
control for details.
Each entry in a Choice
consists of one or both of an image provided
in the form of an Image
object and a text string. The image, if provided,
is rendered in addition to any icon, such as a check box or radio button, supplied by the control
itself.
The number of entries
can be obtained by calling the size()
method. An entry is distinguished by its index, ...
Get J2ME in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.