import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MyGauge 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 MyGauge() { mydisplay = Display.getDisplay(this); } public void startApp() { gauge = new Gauge(" Прогресс: ", true, 10, 0 ); myform.append(gauge); 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(Integer.toString(choice)); myform.setCommandListener(this); mydisplay.setCurrent(myform); } } } }