📄 tictactoemidlet.java
字号:
package example.tictactoe;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
//import javax.microedition.io.*;
//import javax.microedition.*;
public class TicTacToeMIDlet extends MIDlet{
private Command exitCommand;
private Display display;
private ChoosePieceScreen choosePieceScreen;
private GameScreen gameScreen;
public TicTacToeMIDlet(){
display = Display.getDisplay(this);
exitCommand = new Command("离开", Command.SCREEN, 2);
}
public void startApp(){
Displayable current = Display.getDisplay(this).getCurrent();
if (current == null) {
Image logo = null;
try {
logo = Image.createImage("/tictactoe.png");
}
catch (Exception e) {
}
Alert splashScreen = new Alert(null,
"Tic-Tac-Toe\nForumNokia", logo,
AlertType.INFO);
splashScreen.setTimeout(3000);
choosePieceScreen = new ChoosePieceScreen(this);
Display.getDisplay(this).setCurrent(splashScreen, choosePieceScreen);
}
else {
Display.getDisplay(this).setCurrent(current);
}
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
public void quit(){
destroyApp(false);
notifyDestroyed();
}
/**回调在这一应用中为游戏创建并且显示游戏的第一个屏幕之后的屏幕,即主屏幕(GameScreen)。
* @param isPlayerCircle
*/
public void choosePieceScreenDone(boolean isPlayerCircle){
gameScreen = new GameScreen(this, isPlayerCircle);
Display.getDisplay(this).setCurrent(gameScreen);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -