MIDP UI Compared to Desktop AWT
The differences between mobile devices and desktop computers
are evident when comparing the designs of the MIDP lcdui with the Abstract Windowing Toolkit (AWT) of
the JavaTM 2 Platform, Standard
Edition.
AWT was designed and optimized for desktop computers. The
assumptions that are appropriate for desktop computers are not appropriate for
mobile devices. For example, when a user interacts with AWT, event objects are
created dynamically. These objects are short-lived and exist only until each
associated event is processed by the system. The event object then becomes
garbage and must be reclaimed by the garbage collector of the Java virtual
machine. The limited CPU and memory subsystems of a mobile information device
(MID) typically cannot afford the overhead of unnecessary garbage objects. To
limit the creation of such objects, lcdui events
are simply method calls that pass the event parameters directly as the
parameters of the method.
AWT also assumes certain desktop environment specific user
interaction models. For instance, the component set of AWT was designed to work
with a pointing device
such as a mouse or pen. As
mentioned earlier, this assumption is valid only for a small subset of MIDs,
since most of the MIDP target devices have just a keypad for user input. The
MIDP user interface API uses a layer of abstraction to separate applications
from concrete input methods used in different devices.
For example, a MIDP device with touch input allows the
user to use this input method on high-level user interface components but it is
not visible to applications. The different concrete input methods are
transparent to the application code.
AWT has extensive support for window management, such as
overlapping windows, window resizing, and so forth. In contrast, MIDP target
devices have small displays that are not large enough for multiple overlapping
windows. The lcdui API of MIDP has no window
management capabilities. A lcdui user interface is constructed using a
set of Displayables. This displayable model
and the class structure of user interface are described in the next
section.