Código:
saludos 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; import javax.microedition.midlet.MIDletStateChangeException; public class holamundo extends MIDlet implements CommandListener { private Display pantalla; private TextBox saludos; private Command aceptarCmd; public holamundo(){ saludos= new TextBox("saludo", "hola mundo", 256, 0); aceptarCmd= new Command("Aceptar", Command.SCREEN, 1); } public void commandAction(Command c, Displayable d) { if(c == aceptarCmd){ try { destroyApp(true); } catch (MIDletStateChangeException e) { e.printStackTrace(); } notifyDestroyed(); } } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { // TODO Auto-generated method stub } protected void pauseApp() { pantalla=null; } protected void startApp() throws MIDletStateChangeException { pantalla=Display.getDisplay(this); saludos.addCommand(aceptarCmd); saludos.setCommandListener((CommandListener)this); pantalla.setCurrent(saludos); } }