📄 gaugedemo.java~3~
字号:
//GaugeDemo.javaimport javax.microedition.midlet.*;import javax.microedition.lcdui.*;public class GaugeDemo extends MIDlet implements CommandListener{ private Display display; private Form form; private Command cmdExit = new Command("Exit",Command.SCREEN,1); private Gauge gauge; public GaugeDemo() { display = Display.getDisplay(this); gauge = new Gauge("Gauge Demo",true,10,3); form = new Form("Degree"); form.append(gauge); form.append(new StringItem("Current Degree:"," 3")); form.addCommand(cmdExit); form.setCommandListener(this); ItemStateListener listener = new ItemStateListener() { public void itemStateChanged(Item item) { if(item == gauge) { ((StringItem)form.get(1)).setText(" " + gauge.getValue()); } } }; form.setItemStateListener(listener); } public void startApp() { display.setCurrent(form); } public void pauseApp(){} public void destroyApp(boolean unconditional){} public void commandAction(Command c,Displayable d) { if(cmdExit == c) { destroyApp(false); notifyDestroyed(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -