?? gaugetest.java~4~
字號:
package j2me;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class GaugeTest extends MIDlet implements CommandListener{
private Form form;
private List startmenu;
private String choices[]={"Interactive Gauge","Non-interactive Gauge"};
private Command backCommand = new Command("Back", Command.BACK, 1);
private Command exitCommand = new Command("EXIT", Command.EXIT, 1);
private Display display;
public GaugeTest() {
//create a list as start menu
startmenu= new List("Chooise a Gauge type",List.IMPLICIT,choices,null);
startmenu.addCommand(exitCommand);
startmenu.setCommandListener(this);
//create a form to manage a gauge
form= new Form("Gauge Test");
form.addCommand(backCommand);
form.setCommandListener(this);
//retrieve display object
display=Display.getDisplay(this);
}
public void startApp() throws MIDletStateChangeException {
display.setCurrent(startmenu);
}
/**
* Pause the MIDlet
*/
public void pauseApp() {
}
/**
* Called by the framework before the application is unloaded
*/
public void destroyApp(boolean unconditional) {
form=null;
startmenu=null;
backCommand = null;
exitCommand = null;
display=null;
}
public void commandAction(Command c, Displayable d) {
if(d==startmenu && c==List.SELECT_COMMAND) {
if(form.size()>0) form.delete(0);
if(startmenu.getSelectedIndex()==0) {
form.append(new Gauge("Interactive Gauge",true,10,4));
}
else {
form.append(new Gauge("Non-interactive Gauge",false,10,4));
}
display.setCurrent(form);
}
else if(c==backCommand) {
display.setCurrent(startmenu);
}
else if(c==exitCommand) {
destroyApp(true);
notifyDestroyed();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -