O'Reilly logo

J2ME in a Nutshell by Kim Topley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 and EXCLUSIVE, apart from the visual differences, lies in the way in which selection changes are notified to application code. See the description of the List 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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required