Code:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class GaugeDemo extends MIDlet implements CommandListener {
private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
private Display display;
private NonInteractiveGaugeRunnable nonInteractive;
private Form mainForm;
public GaugeDemo() {
display = Display.getDisplay(this);
mainForm = new Form("Gauge Demo");
nonInteractive = new NonInteractiveGaugeRunnable("Non Interactive", 10, 0);
new Thread(nonInteractive).start();
mainForm.append(nonInteractive);
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
}
protected void startApp() {
display.setCurrent(mainForm);
}
protected void destroyApp(boolean unconditional) {
nonInteractive.setDone();
}
protected void pauseApp() {
}
public void commandAction(Command c, Displayable d) {
destroyApp(false);
notifyDestroyed();
}
}
and one more canvas class
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class GaugeDemo extends MIDlet implements CommandListener {
private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
private Display display;
private NonInteractiveGaugeRunnable nonInteractive;
private Form mainForm;
public GaugeDemo() {
display = Display.getDisplay(this);
mainForm = new Form("Gauge Demo");
nonInteractive = new NonInteractiveGaugeRunnable("Non Interactive", 10, 0);
new Thread(nonInteractive).start();
mainForm.append(nonInteractive);
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
}
protected void startApp() {
display.setCurrent(mainForm);
}
protected void destroyApp(boolean unconditional) {
nonInteractive.setDone();
}
protected void pauseApp() {
}
public void commandAction(Command c, Displayable d) {
destroyApp(false);
notifyDestroyed();
}
}
