Use active and inactive Gauge : Gauge « J2ME « Java Tutorial






Use active and inactive Gauge
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Gauge;
import javax.microedition.midlet.MIDlet;

public class J2MEActiveInactiveGaugeMIDlet extends MIDlet implements CommandListener {

  private Command exitCommand = new Command("exit", Command.EXIT, 1);

  private Gauge activeGauge = new Gauge("active:", true, 10, 2);

  private Gauge inactiveGauge = new Gauge("inactive:", false, 10, 4);

  private Display display = Display.getDisplay(this);

  public void startApp() {
    Form aForm = new Form("Gauge");

    aForm.append(activeGauge);
    aForm.append(inactiveGauge);

    aForm.addCommand(exitCommand);
    aForm.setCommandListener(this);
    display.setCurrent(aForm);
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {
  }

  public void commandAction(Command c, Displayable s) {
    if (c == exitCommand) {
      destroyApp(false);
      notifyDestroyed();
    }
  }
}








31.15.Gauge
31.15.1.Add Gauge to a formAdd Gauge to a form
31.15.2.Use active and inactive GaugeUse active and inactive Gauge
31.15.3.new Gauge(null, false, 100, 50)new Gauge(null, false, 100, 50)
31.15.4.Gauge TrackerGauge Tracker
31.15.5.Gauge Non InteractiveGauge Non Interactive
31.15.6.Gauge InteractiveGauge Interactive