Java Reference
In-Depth Information
public void startApp() {
frame.show();
}
When the application is paused, you do nothing because you do not have any allocated resources to free.
However, you need to provide an empty implementation, because implementation of
pauseApp()
is
mandatory:
public void pauseApp(){
}
Like
startApp()
and
pauseApp()
, the implementation of
destroyApp()
is mandatory. Here,
we dispose of the frame, freeing the associated system resources:
public void destroyApp(boolean unconditional) {
frame.dispose();
}
}
PDA User Interface
The PDA user interface is based on the J2SE Abstract Window Toolkit (AWT). This section of the
chapter is structured as follows: First, we compare the PDA AWT subset with other AWT versions.
Then, a short general introduction to the AWT programming is given. The sections "
Custom
Components
"
and "
Custom Layout Managers
"
cover some aspects with special importance for
programming limited devices. The section "
Multiple Threads in the PDAP AWT Subset
"
shows how
you can build multithreaded AWT programs, although the PDAP AWT subset is limited to a SWING-
like single thread model. Finally, we'll implement an AWT application combining some of the
discussed concepts.
Comparison of the PDAP AWT Subset to Other AWT Versions
The
java.awt
classes included in PDAP are based on the (CDC-based) Personal Profile AWT
building block. The Personal Profile AWT is a clean subset of Java 2.0 AWT. It covers the complete
Java 1.1 AWT, and contains several additions from Java 2, such as buffered images, support for thread-
safe access and several convenience methods. Thread-safe AWT programming is discussed in more
detail in the section "
Multiple Threads in the PDAP AWT Subset
."
Additionally, some methods
helping to reduce creation of intermediate objects introduced with Java 2.0 were taken over into the
Personal Profile. Examples for this type of methods are
getWidth()
, which replaces a call to
getSize()
returning an intermediate dimension object.
Compared to the Personal Profile AWT, the PDAP AWT is slightly more restricted. The PDAP AWT
subset contains only the packages
java.awt
,
java.awt.event
, and
java.awt.image
.
Moreover, those packages are not complete; several classes and methods are missing. For example,
more Java 2 additions such as buffered images and
Graphics2D
support were left out. The
Cloneable
,
Serializable
, and
Externalizable
interfaces are not supported in CLDC. Also,
the
AWTPermission
was left out because the implied security model is not part of CLDC. A
complete comparison of the PDAP AWT subset to the Java 2 AWT API can be found in
Appendix
B
,
"Comparison Charts."
Figure 4.1
illustrates the relations between the different AWT versions.
Figure 4.1. Subset relations among the different AWT versions.
Search WWH ::
Custom Search