Line-by-line Anatomy of HelloMIDlet.java (Cont.)
A MIDlet goes through the following states:
- When the MIDlet is about to be run, an instance is created.
The MIDlet's constructor is run, and the MIDlet is in the
Paused state.
- Next, the MIDlet enters the
Active state after the application manager calls startApp( ).
- While the MIDlet is
Active, the JAM can suspend its execution by calling pauseApp( ), which puts the MIDlet back in the Paused state.
- The application manager can terminate the execution of the MIDlet by calling
destroyApp( ), at which point the MIDlet is Destroyed and patiently awaits garbage collection.
display = Display.getDisplay(this);
The method public static Display javax.microedition.lcdui.Display.getDisplay (MIDlet m) gets the Display object that is unique to this MIDlet.
cmdExit = new Command("Exit", Command.SCREEN, 1);
The constructor public javax.microedition.lcdui.Command(String label, int commandType, int priority) creates a new command object with the following parameters:
label — The label string is what the application requests to be shown to the user to represent this command.
commandType — The command types include BACK, CANCEL, EXIT, HELP, ITEM, OK, SCREEN, or STOP.
†public static final int SCREEN specifies an application-defined command that pertains to the current screen.
priority — The application uses the value to describe the importance of this command relative to other commands on the same screen.