📄 midlettwo.java
字号:
import javax.microedition.midlet.*;import javax.microedition.lcdui.*;public class MIDletTwo extends MIDlet implements Runnable, CommandListener{ Thread thread; List list; int number = 0; Display display; Command switchCmd; Command exitCmd; boolean first = true; public MIDletTwo(){ list = new List("MIDletTwo", List.IMPLICIT); list.append("MIDlet Two:"+number, null); thread = new Thread(this); switchCmd = new Command("Switch",Command.SCREEN,1); exitCmd = new Command("Exit",Command.EXIT,1); display = Display.getDisplay(this); list.addCommand(switchCmd); list.addCommand(exitCmd); list.setCommandListener(this); } public void startApp(){ System.out.println("OK"); if(first){ thread.start(); first = false; } display.setCurrent(list); } public void run(){ while(true){ try{ Thread.sleep(2000); number++; list.set(0,"MIDlet Two:"+number, null); }catch(Exception e){} } } public void pauseApp(){ } public void destroyApp(boolean unconditional){ thread = null; } public void commandAction(Command c, Displayable d){ if(c == switchCmd){ pauseApp(); notifyPaused(); resumeRequest(); }else if(c == exitCmd){ destroyApp(false); notifyDestroyed(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -