Java Reference
In-Depth Information
StringItem
This is a display-only item that can contain a string and the user can-
not edit the contents. Both the label and content of the
StringItem
can, however, be changed by the application. As with
ImageItem
, its
appearance can be specified at creation as one of PLAIN, HYPERLINK or
BUTTON. The developer is able to set the text, using the
setText()
method, and its appearance, using
setFont()
.
TextField
A
TextField
is an editable text component that may be placed in a
Form
. It can be given an initial piece of text to display. It has a maxi-
mum size, set by
setSize(int size)
, and an input mask, which can
be set when the item is constructed. An input mask is used to ensure
that end users enter the correct data, which can reduce user frustra-
tion. The following masks can be used: ANY, EMAILADDR, NUMERIC,
PHONENUMBER, URL, and DECIMAL. These constraints can be set
using the
setConstraints()
method and retrieved using
getCon-
straints()
. The constraint settings should be used in conjunction
with the following set of modifier flags using the bit-wise AND (
&
)
operator: PASSWORD, SENSITIVE, UNEDITABLE, NON PREDICTIVE,
INITIAL CAPS WORD, INITIAL CAPS SENTENCE.
Ticker
This implements a ticker-tape object - a piece of text that runs continu-
ously across the display. The direction and speed of the text is determined
by the device. The ticker scrolls continuously and there is no interface to
stop and start it. The implementation may pause it when there has been a
period of inactivity on the device, in which case the ticker resumes when
the user recommences interaction with the device.
2.3.3 LCDUI Interfaces
The user interface package,
javax.microedition.lcdui
, provides
four interfaces that are available to both the high- and low-level APIs:
•
Choice
defines an API for user-interface components, such as
List
and
ChoiceGroup
. The contents of these components are repre-
sented by strings and images which provide a defined number of
choices for the user. The user's input can be one or more choices and
they are returned to the application upon selection.
•
CommandListener
is used by applications that need to receive
high-level events from the implementation; the listener is attached to