Java Reference
In-Depth Information
Chapter 4. PDAP Programming
IN THIS CHAPTER
This chapter discusses the life cycle and user interface of PDA applications. First, we'll talk about
the general design of PDA applications. Then, we'll explain the AWT subset that forms the PDAP
user interface API.
PDAP Application Life Cycle
PDAP is a complete superset of MIDP. As for MIDP, PDAP applications are based on the MIDlet class
and share the MIDlet life cycle, as illustrated in
Figure 3.1
.
However, PDAP contains several additional
packages. For example, the AWT classes allow much more sophisticated user interfaces than lcdui,
giving the programmer fine-grained control over component layout.
In this chapter, we will concentrate on the user interface enhancements of PDAP.
HelloPdap
Revisited
PDAP application. Now that you have the necessary foundation, you can revisit
HelloPdap
from an
API point of view.
First, you import the necessary
midlet
and
awt
packages:
import java.awt.*;
import javax.microedition.midlet.*;
Like all PDAP applications, the
HelloPdap
example is required to extend the
MIDlet
class:
public class HelloPdap extends MIDlet {
In the constructor, you create a
Frame
titled
"HelloPdap"
:
Frame frame;
public HelloPdap() {
frame = new Frame ("HelloPdap");
}
You do not add content to the frame yet, so only the title will be displayed. (A description of the
awt
classes is contained in the "
PDA User Interface
"
section.)
When your MIDlet is started the first time or when the MIDlet resumes from a paused state, the
startApp()
method is called by the program manager. Here, the
show()
method of the frame is
called, requesting that the frame be displayed. If the frame is already visible, it is brought to the
foreground:
Search WWH ::
Custom Search