Java Reference
In-Depth Information
Item
Class
This is the superclass for all items that can be added to a
Form.
Every
Item
has a label, which is a string. This label is displayed by
the implementation as near as possible to the
Item
, either on the
same horizontal row or above. When an
Item
is created, by default
it is not owned by any container and does not have a
Command
or
ItemCommandListener
. However, default commands can be attached
to an
Item
,usingthe
setDefaultCommand()
method, which makes
the user interface more intuitive for the user. A user can then use a
standard gesture, such as pressing a dedicated selection key or tapping on
the item with a pointer. Symbian devices support these interfaces through
S60 and UIQ, respectively.
The following types are derived from
Item
.
ChoiceGroup
A group of selectable objects may be used to capture single or multiple
choices in a
Form.
It is a subclass of
Item
and most of its methods are
implemented via the
Choice
interface.
A
ChoiceGroup
has similar features to a
List
object, but it's meant to
be placed in a
Form
, not used as a standalone
Screen
object. Its type can
be either EXCLUSIVE (to capture one option from the group) or MULTIPLE
(to capture many selections). As usual with high-level UI components,
developers don't have control over the graphical representation of a
ChoiceGroup
. Usually, though, one of EXCLUSIVE type is shown as a
list of radio buttons, while the MULTIPLE type is rendered as a list of
checkboxes.
CustomItem
CustomItem
operates in a similar way to
Canvas
: the developer can
specify precisely what content appears where within its area. Some of
the standard items may not give quite the required functionality, so it
may be better to define home-made ones instead. The drawback to this
approach is that, as well as having to draw all the contents using the
item's
paint()
method, the developer has to process and manage all
events, such as user input, through
keyPressed()
. Custom items may
interact with either keypad- or pointer-based devices. Both are optional
within the specification and the underlying implementation will signal to
the item which has been implemented.
CustomItem
also inherits from
Item
, therefore inheriting the
get-
MinContentWidth()
and
getPrefContentHeight()
methods,
which help the implementation to determine the best fit of items within