test_thread.java
来自「我编写得JAVA ME 手机俄罗斯方块」· Java 代码 · 共 50 行
JAVA
50 行
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 + =
减小字号Ctrl + -
显示快捷键?