In Listing 5.3 (lines 41-49), the MIDlet is started with the standard startApp method, prompt-
ing the user with a list of options (the MIDlet main menu). The commandAction method (lines
54-66), similar to the actionPerformed method, handles user commands from the option list
(as it registered for, at line 48). Some methods pertain to the MIDlet lifecycle: pauseApp ,
destroyApp , startApp .
Only the “register” option triggers a real action (it activates the license registering form in line
57), whereas all other options will show a fake message (line 61). The show method at lines
71-76 simply shows a full-screen message until the user explicitly closes it.
When launched via the Sun MIDlet emulator, our simple program opens up showing an option
list, as shown in Figure 5.2.
F IGURE 5.2
The sample application at work.
When the user selects the registration option, the MIDLicenseManager is invoked (line 57 in
Listing 5.3) for starting the registration procedure, whose menu is shown in Figure 5.3.
The MIDLicenseManager class is general-purpose and not bound to the particular
application code used for launching it. See following for a discussion of this class.