import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Navigator extends MIDlet implements CommandListener { Command exit=new Command("Выход", Command.EXIT, 0); Command gotb=new Command("TextBoks",Command.SCREEN, 1); Command goform=new Command("Form", Command.SCREEN, 2); Command golist=new Command("List", Command.SCREEN, 3); Command goalert=new Command("Alert", Command.SCREEN, 4); int go=0; TextBoks tb=new TextBoks("text",156,0); Form f=new Form("Label"); List l=new List("text zagolovok",List.IMPLICIT); Alert a=new Alert("Zagolovok","Please, wait...",null,null); public Navigator(){ Display d=Display.getDisplay(this); } public void startApp(){ go++; tb.addCommand(exit); tb.addCommand(goform); tb.addCommand(golist); tb.addCommand(goalert); tb.setCommandListener(this); d.setCurrent(tb); } public void pauseApp(){ } public void destroyApp(boolean unco){ notifyDestroyed(); } public void commandAction(Command c, Displayable d){ if(c==exit){ destroyApp(false); notifyDestroyed();} if(c==goform){ go++; f.addCommand(exit); f.addCommand(golist); f.addCommand(gotb); f.addCommand(goalert); f.setCommandListener(this); Display.getDisplay(this).setCurrent(f);} if(c==golist){ l.addCommand(exit); l.addCommand(goalert); l.addCommand(gotb); l.addCommand(goform); l.setCommandListener(this); Display.getDisplay(this).setCurrent(l);} if(c==goalert){ go++; a.addCommand(exit); a.addCommand(golist); a.addCommand(goform); a.addCommand(gotb);} f.setCommandListener(this); Display.getDisplay(this).setCurrent(f);} if(c==gotb){ go++; startApp();} } }