Java Reference
In-Depth Information
To create an
ImageItem
, just supply the
Image
that is to be displayed, the label, layout, and
alternate text.
Layout
is controlled with the layout constants in the
Item
class.
ImageItem
also defines
constants for the layout parameter. One way to control the layout is to specify the default value,
LAYOUT_DEFAULT
. If you need more control, combine a horizontal value with a vertical value.
The horizontal values are
LAYOUT_LEFT
, _
LAYOUT_CENTER
, and
LAYOUT_RIGHT
. The vertical values
are
LAYOUT_NEWLINE_BEFORE
and
LAYOUT_NEWLINE_AFTER
. The constants in the
ImageItem
class
are present mainly for backward compatibility with older MIDP versions.
ImageItem
supports appearance modes just like
StringItem
.
ItemItem
includes a constructor
that allows you to set the appearance mode.
Figure 6-8 shows a form containing a single
ImageItem
.
Figure 6-8.
An ImageItem
DateField
DateField
is an extremely handy mechanism by which users can enter dates, times, or both. It's
up to the implementation to determine some reasonable way for users to enter dates and times;
you, as the MIDlet programmer, simply use
DateField
and not worry about the
implementation.
To create a
DateField
, specify a label and a type. Three constants in the
DateField
class
describe the different types:
•
DATE
displays an editable date.
•
TIME
displays an editable time.
•
DATE_TIME
displays both a date and a time.
DateField
provides two constructors. The first uses the default time zone, while the second
allows you to specify a
TimeZone
explicitly:
public DateField(String label, int mode)
public DateField(String label, int mode, TimeZone timeZone)
Search WWH ::
Custom Search