HelloMIDletpublic class HelloMIDlet extends MIDlet implements CommandListenerAn example MIDlet with simple "Hello" text and an exit command. |
Fields Summary |
---|
private Command | exitCommand | private TextBox | textBox | private Display | display |
Constructors Summary |
---|
public HelloMIDlet()Constructs the HelloMIDlet, its screen, and
its command. It associates the screen and command,
and caches the MIDlets display.
// Create the abstract command
exitCommand = new Command("Exit", Command.EXIT, 1);
// Create the screen and give it a command and a listener
textBox = new TextBox("Hello MIDlet", "Test string",
256, TextField.ANY | TextField.UNEDITABLE);
textBox.addCommand(exitCommand);
textBox.setCommandListener(this);
// Set the MIDlet's display to its initial screen
display = Display.getDisplay(this);
display.setCurrent(textBox);
|
Methods Summary |
---|
public void | commandAction(Command command, Displayable screen)
if (command == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
| public void | destroyApp(boolean unconditional)Destroys the MIDlet; this method does nothing because
there is nothing to cleanup that is not handled by the
garbage collector.
| public void | pauseApp()Pauses the MIDlet; this method does nothing because
there are no background activities or shared resources
to close.
| public void | startApp()Starts the MIDlet; this method does nothing because
the MIDlet does not require any shared resources.
|
|