import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Gauge extends MIDlet implements CommandListener { private Command exitMidlet = new Command("Выход", Command.EXIT, 1); private Command OK = new Command("OK", Command.OK,1); private Form myform = new Form(" Класс Gauge "); private Form f1 = new Form(" Класс Gauge "); Gauge gauge; private Display mydisplay; public Gauge() { mydisplay = Display.getDisplay(this); } public void startApp() { myform.append(new Gauge(" Прогресс: ", true, 10, 0 )); myform.addCommand(exitMidlet); myform.addCommand(OK); 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 == OK) { int choice = Gauge.getValue(); { switch(choice) { case 0:/*pervaya forma*/; break; case 1:/*vtoraya forma*/; break; case 2:/*tretya forma*/; break; } myform.append(choice); myform.setCommandListener(this); mydisplay.setCurrent(myform); } } } }