/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * @author Администратор */ public class Main extends MIDlet implements CommandListener { Display disp; Command exit; Command ok; Form form; TextBox tb; String s="Test"; public Main() { disp=Display.getDisplay(this); } public void startApp() { form=new Form("Voice"); exit=new Command("Выйти",Command.EXIT,1); ok=new Command("Ok",Command.OK,1); tb=new TextBox("Введите текст",s,1024,0); tb.addCommand(ok); tb.addCommand(exit); tb.setCommandListener(this); form.addCommand(ok); form.addCommand(exit); form.setCommandListener(this); disp.setCurrent(tb); } public void pauseApp() { } public void destroyApp(boolean unconditional) { notifyDestroyed(); } public void commandAction(Command c, Displayable d) { if(c==exit&&d==form) { destroyApp(false); notifyDestroyed(); if(c==ok&&d==tb) { F();} } } public void F() { s=tb.getString(); form.deleteAll(); form.append(s); disp.setCurrent(form); } }