📄 testlet.java.svn-base
字号:
import javax.microedition.lcdui.*;import javax.microedition.io.*;import javax.microedition.midlet.*;import java.io.*;public class Testlet extends MIDlet implements CommandListener { private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1); private final static Command CMD_BACK = new Command("Ok", Command.BACK, 1); public Display display; private List mainList; private boolean firstTime; public Testlet() { display = Display.getDisplay(this); firstTime = true; } protected void startApp() { if (firstTime) { String[] stringArray = { "按键测试", "查看数据", "下载程序", "发送数据" }; mainList = new List("选项列表", Choice.IMPLICIT, stringArray, null); mainList.addCommand(CMD_EXIT); mainList.setCommandListener(this); display.setCurrent(mainList); firstTime = false; } } protected void destroyApp(boolean unconditional) { } protected void pauseApp() { } public void returnMainList() { display.setCurrent(mainList); } public void commandAction(Command c, Displayable d) { if (d.equals(mainList)) { // in the main list if (c == List.SELECT_COMMAND) { if (d.equals(mainList)) { switch (((List)d).getSelectedIndex()) { case 0: TestCanvas canvas = new TestCanvas( this,true ); display.setCurrent(canvas); break; case 1: DebugForm dbForm = new DebugForm("参数信息", this ); dbForm.setContent( DeviceInfos.getInstance().toString() ); // dbForm.setContent( DeviceInfos.getInstance().toXML() ); // System.out.println(DeviceInfos.getInstance().toXML()); display.setCurrent(dbForm); break; case 2: DownloadForm dlForm = new DownloadForm( "下载",this ); display.setCurrent(dlForm); break; case 3: SendForm sendForm = new SendForm( "发送数据",this ); display.setCurrent(sendForm); break; } } } } else { // in one of the sub-lists if (c == CMD_BACK) { display.setCurrent(mainList); } } if (c == CMD_EXIT) { destroyApp(false); notifyDestroyed(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -