import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Perexod extends MIDlet implements CommandListener { private Command exitMidlet; private Command perexodTextBox; private Command perexodList; private Command perexodAlert; private Display mydisplay; private Alert myAlert; public Perexod() { mydisplay = Display.getDisplay(this); exitMidlet = new Command("Exit", Command.EXIT, 1); perexodTextBox = new Command("TextBox", Command.SCREEN, 2); } public void startApp() { Form myform = new Form("this is object form"); myform.addCommand(exitMidlet); myform.addCommand(perexodTextBox); myform.setCommandListener(this); mydisplay.setCurrent(myform); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { if (c == exitMidlet) { destroyApp(false); notifyDestroyed(); } if (c == perexodTextBox) { TextBox tb = new TextBox("TextBox", "text", 256, 0); perexodList = new Command("perexod", Command.SCREEN, 2); tb.addCommand(exitMidlet); tb.addCommand(perexodList); tb.setCommandListener(this); Display.getDisplay(this).setCurrent(tb); } if (c == perexodList) { List mylist = new List("List", List.IMPLICIT); perexodAlert = new Command("perexod", Command.SCREEN, 2); mylist.addCommand(exitMidlet); mylist.addCommand(perexodAlert); mylist.setCommandListener(this); Display.getDisplay(this).setCurrent(mylist); } if (c == perexodAlert) { myAlert = new Alert("Alert", "xz", null, null); Display.getDisplay(this).setCurrent(myAlert); } } }