📄 test_thread.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Test_Thread extends MIDlet implements CommandListener {
ThreadCanvas2 tc;
Command exitCommand;
Command startCommand;
Command pauseCommand;
public Test_Thread() {
// TODO 自动生成构造函数存根
tc = new ThreadCanvas2();
exitCommand = new Command("exit",Command.EXIT,1);
startCommand = new Command("start",Command.OK,1);
pauseCommand = new Command("pause",Command.OK,1);
tc.addCommand(exitCommand);
tc.addCommand(pauseCommand);
tc.setCommandListener(this);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO 自动生成方法存根
}
protected void pauseApp() {
// TODO 自动生成方法存根
}
protected void startApp() throws MIDletStateChangeException {
// TODO 自动生成方法存根
Display.getDisplay(this).setCurrent(tc);
}
public void commandAction(Command arg0, Displayable arg1) {
// TODO 自动生成方法存根]
if(arg0.equals(pauseCommand)){
tc.removeCommand(pauseCommand);
tc.addCommand(startCommand);
tc.pause();
}
if(arg0.equals(startCommand)){
tc.removeCommand(startCommand);
tc.addCommand(pauseCommand);
tc.start();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -