/* This is a midlet to create an interactive gauge */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class InterGauge extends MIDlet implements CommandListener{ private Display display; // declare a display object private Form fmMain; // main form private Command cmExit; // exit command private Gauge gaVol; /// Volume Gauge String s1 = "Volume Level"; // Volume level text public InterGauge(){ display = Display.getDisplay(this); // Create the gauge and the xit command gaVol = new Gauge(s1, true, 50, 2); // true indicate the gauge to interactive // maximum value is set to 50 and the starting value is 2 cmExit = new Command("Exit", Command.EXIT, 1); // Create form - add commands - listen for events fmMain = new Form("Gauge Level"); fmMain.addCommand(cmExit); fmMain.append(gaVol); fmMain.setCommandListener(this); } // start app public void startApp(){ display.setCurrent(fmMain); } // pause app public void pauseApp(){ } // destroy app public void destroyApp(boolean unconditional){ } public void commandAction(Command c, Displayable s){ if (c == cmExit){ destroyApp(false); notifyDestroyed(); } } }