import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
public class CommandQuitGoodbyeWorld extends MIDlet implements CommandListener {
private Display display;
private TextBox textBox;
private Command quitCommand;
public void startApp() {
display = Display.getDisplay(this);
quitCommand = new Command("Quit", Command.SCREEN, 1);
textBox = new TextBox("Goodbye World", "My second MIDlet", 40, 0);
textBox.addCommand(quitCommand);
textBox.setCommandListener(this);
display.setCurrent(textBox);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command choice, Displayable displayable) {
if (choice == quitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}