Java Reference
In-Depth Information
a call to
callSerially()
, is made after any pending
repaint()
requests have been satisfied. There is, however, one exception to this
rule: when the
Canvas.serviceRepaints()
method is called by the
MIDlet, it causes the
Canvas.paint()
method to be invoked by the
implementation and then waits for it to complete. This occurs whenever
the
serviceRepaints()
method is called, regardless of where the
method was called from, even if that source was an event callback itself.
The
Command
Class
Abstract commands are used to avoid having to implement concrete
command buttons; semantic representations are used instead. The com-
mands are attached to displayable objects, such as high-level
List
or
Form
objects or low-level
Canvas
objects. The
addCommand()
method
attaches a command to the displayable object. The command speci-
fies the label, type and priority. The
CommandListener
interface then
implements the actual semantics of the command. The native style of the
device may prioritize where certain commands appear on the UI. For
example, Exit is always placed above the right softkey on Nokia devices.
There are also some device-provided operations that help contribute
towards the operation of the high-level API. For example, screen objects,
such as
List
and
ChoiceGroup
, have built-in events that return user
input to the application for processing.
2.3.2 LCDUI High-Level API: Screen Objects
Alert
,
List
,
TextBox
,and
Form
objects are all derived from
Screen
,
itself derived from
Displayable
.
Screen
objects are high-level UI
components that can be displayed. They provide a complete user
interface, of which the specific look and feel is determined by the
implementation. Only one
Screen
-derived object can be displayed at a
time. Developers can control which
Screen
is displayed by using the
setCurrent()
method of the
Display
class.
This section describes the high-level API classes in a succinct manner,
rather than going into every detail. To find a complete description of each
featured class, please check the MIDP documentation.
Alert
Object
An
Alert
object shows a message to the user, waits for a certain
period and then disappears, at which point the next displayable object
is shown. An
Alert
object is a way of informing the user of any errors
or exceptional conditions. It may be used by the developer to inform the
user that:
•
an error or other condition has been reached