站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Programming Wireless Devices with the Java2 Platform

Programming Wireless Devices with the Java2 Platform

[ directory ] Previous Section Next Section

10.6 ChoiceGroup

A ChoiceGroup defines a group of selectable elements that can be placed within a Form. A ChoiceGroup is similar to a List (Section 9.1, "List"), but it supports only the exclusive and multiple choice modes.

graphics/new_icon.gif

Also available is a ChoiceGroup-specific POPUP mode. The selection behavior of a pop-up choice is identical to that of an exclusive choice. The pop-up choice differs from an exclusive choice in presentation and interaction. Whereas the EXCLUSIVE type of ChoiceGroup presents all the elements in line as a radio button list, the POPUP type shows only the currently selected element in line in the Form. The other elements are hidden until the user performs an action to show them. When the user performs this action, all elements become accessible. For example, a device may use a pop-up menu to display the elements.

Generally, the device is responsible for providing the graphical representation of these ChoiceGroup modes and must provide a visually different representation for different modes. For example, it might use radio buttons for the exclusive choice mode, check boxes for the multiple choice mode, and pop-up menus without any specific graphics for pop-up mode.

An example:

graphics/10inf07.gif
ChoiceGroup choice =
    new ChoiceGroup("Size:",
                    Choice.EXCLUSIVE);
choice.append("Small", null);
choice.append("Large", null);
form.append(choice);
    [ directory ] Previous Section Next Section