// En MIDlet som visar en textruta och ett Exit-kommando import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Kommandotest2 extends MIDlet implements CommandListener { private Display displayen; private TextBox textrutan; private Command exitkommandot; public Kommandotest2() { } public void destroyApp(boolean unconditional) { } public void pauseApp() { } public void startApp() { textrutan = new TextBox("Hej!", "Hej, världen!", 20, 0); exitkommandot = new Command("Exit", Command.EXIT, 0); textrutan.addCommand(exitkommandot); textrutan.setCommandListener(this); displayen = Display.getDisplay(this); displayen.setCurrent(textrutan); } public void commandAction(Command c, Displayable s) { notifyDestroyed(); } }