Java Reference
In-Depth Information
•
a user action has been completed successfully
•
an event for which the user has previously requested notification has
been completed.
To emphasize these states to the user, the
AlertType
can be set to
convey the context or importance of the message. For each use case
described above, there's a relevant type, such as ALARM, CONFIRMA-
TION, ERROR and INFO. These are differentiated by titles at the top of
the alert screen, icons drawn on the alert, and the sound played when it
is displayed.
List
Object
A
List
object is a screen object that contains a list of choices for the user
and is, therefore, ideal for implementing choice-based menus, which are
the core user interface of most mobile devices.
TextBox
Object
A
TextBox
is a
Screen
object that allows the user to enter and edit text
in a separate space away from the form. It is a
Displayable
object and
can be displayed on the screen in its own right. Its maximum size can be
set at creation, but the number of characters displayed at any one time is
unrelated to this size and is determined by the device itself.
Form
Object
A
Form
object is designed to contain a small number of closely-related
user interface elements. Those elements are, in general, subclasses of the
Item
class and we shall investigate them in more detail below. The
Form
object manages the traversal, scrolling and layout of the items.
Items enclosed within a form may be edited using the
append()
,
delete()
,
insert()
and
set()
methods. They are referred to by
their indexes, starting at zero and ending with
size()-1
. Items are
organized via a layout policy that is based around rows. The rows
typically relate to the width of the screen and are constant throughout.
Forms grow vertically and a scroll bar is introduced as required. If a form
becomes too large, it may be better for the developer to create another
screen. Users can interact with a
Form
and a
CommandListener
can
be attached to capture this input using the
setCommandListener()
method. An individual
Item
can be given an
ItemCommandListener
,
if a more contextual approach is required by the UI.