gaugemidlet.java

来自「j2me的程序」· Java 代码 · 共 47 行

JAVA
47
字号
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
// A first MIDlet with simple text and a few commands.
public class GaugeMIDlet extends MIDlet implements CommandListener{

  private Command exitCommand;

  private Gauge activeGauge;
  private Gauge inactiveGauge;

  private Display display;

  public GaugeMIDlet() {
    display = Display.getDisplay(this);

    exitCommand = new Command("离开", Command.EXIT, 1);

    activeGauge = new Gauge("可调整:",true,10,2);
    inactiveGauge = new Gauge("不可调整:",false,10,4);

  }

  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();
    }

  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?