gaugedemo.java~3~
来自「J2ME高级用户界面的学习代码」· JAVA~3~ 代码 · 共 52 行
JAVA~3~
52 行
//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 + =
减小字号Ctrl + -
显示快捷键?