Java Reference
In-Depth Information
public class HelloPdap extends MIDlet {
private Frame frame;
HelloPdap() {
frame = new Frame("HelloPdap");
frame.pack();
}
public void startApp() {
frame.show();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
frame.dispose();
}
}
Besides the application itself, the JAD files also need a slight modification. Again, any valid
MIDP JAD file is also a valid PDAP JAD file. However, for "true" PDAP applications, using the
advanced capabilities of the PDA profile, a new entry type PDAlet-< Number > must be used. If
a MIDlet-< Number > entry with the same number < Number > is included, the PDAlet entry
overrides the corresponding MIDlet entry. This allows you to include both MIDP and PDAP
versions of the same application in a single pair of JAD and JAR files. The syntax of the PDAlet
entries is identical to the syntax of the MIDlet entries. For our example, a corresponding JAD file
including the MIDP version of the sample is shown in Listing 1.5 .
Listing 1.5 HelloPdap.jad —The JAD File for the HelloPdap Application, and the
HelloMidp MIDlet as a Fallback Option
MIDlet-Name: Hello
MIDlet-Version: 1.0
MIDlet-Vendor: Michael Kroll & Stefan Haustein
MIDlet-Jar-Size: ???
MIDlet-Jar-URL: hello.jar
MIDlet-1: HelloMidp, , HelloMidp
PDAlet-1: HelloPdap, , HelloPdap
Summary
In this chapter, you learned the history and background of J2ME and the CLDC configuration. We
covered the MID and PDA profiles and gave you an overview of some existing software
development kits. You should be able to set up the Sun development kits, to compile actual MID
and PDA programs, and to run them in the corresponding device emulation.
The following chapters will first describe the Connected Limited Device Configuration (CLDC).
Then, we'll revisit the MIDP and PDAP "Hello World" applications from an API point of view
and explain the lifecycle of a MIDlet. We will also explain the user interface of MID and PDA
applications in depth.
 
 
Search WWH ::




Custom Search