import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class index extends MIDlet implements CommandListener { //создаем обьект кнопки выхода private Command exitButton; //переход на следующий экран private Command ekranTextbox; private Command ekranList; private Command ekranAlert; private Display ekran; public index() { ekran = Display.getDisplay(this); exitButton = new Command("Выйти", Command.EXIT, 1); ekranTextbox = new Command("Перейти" , Command.SCREEN, 2); } public void startApp() { Form myform = new Form("Это тестовый экран под Form."); myform.addCommand(exitButton); myform.addCommand(ekranTextbox); myform.setCommandListener(this); ekran.setCurrent(myform); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void CommandAction(Command c, Displayable s) { if(c == exitButton) { destroyApp(false); notifyDestroyed(); } if(c == ekranTextbox) { Textbox txt = new Textbox("Textbox", "Текст", 256, 0); ekranList = new Command("Перейти", Command.SCREEN, 2); txt.addCommand(exitButton); txt.addCommand(ekranList); txt.setCommandListener(this); Display.getDisplay(this).setCurrent(txt); } if(c == ekranList) { List listva = new List("List", List.IMPLICIT); ekranAlert = new Command("Перейти", Command.SCREEN, 2); listva.addCommand(exitButton); listva.addCommand(ekranAlert); listva.setCommandListener(this); Display.getDisplay(this).setCurrent(listva); } } }