Java Reference
In-Depth Information
else if (c == mIdleCommand) {
mContinuousGauge.setValue(Gauge.CONTINUOUS_IDLE);
mIncrementalGauge.setValue(Gauge.INCREMENTAL_IDLE);
}
}
}
ChoiceGroup
Another class in the
Form
arsenal of
Item
s is
ChoiceGroup
.
ChoiceGroup
offers a list of choices. It
is very similar to
javax.microedition.lcdui.List
, which was described at the beginning of this
chapter. This similarity is more than coincidental;
ChoiceGroup
and
List
both implement the
Choice
interface, which is the wellspring of all of the instance methods in both classes.
If you read the section about
List
, you already know almost everything you need to know
to use
ChoiceGroup
because the instance methods work exactly the same way.
ChoiceGroup
features the following constructors:
public ChoiceGroup(String label, int choiceType)
public ChoiceGroup(String label, int choiceType, String[] stringElements,
Image[] imageElements)
The
choiceType
should look familiar; it can be either
EXCLUSIVE
or
MULTIPLE
, the constants
defined in the
Choice
interface. In fact,
ChoiceGroup
's constructors work exactly like
List
's
constructors, except that
IMPLICIT
is not allowed. This makes sense, since a
ChoiceGroup
is one
item in a form, not an entire screen. There is also a
POPUP
type for
ChoiceGroup
that makes it
appear like a combo box or a drop-down menu. The
ChoiceGroup
appears like any other element
in the
Form
; Figure 6-12 shows examples.
(a)
(b)
(c)
Figure 6-12.
ChoiceGroup examples: (a) MULTIPLE, (b) EXCLUSIVE, and (c) POPUP
Search WWH ::
Custom Search