tictactoemidlet.java
来自「经典的一个小游戏;用java编写;适合在手机上移植」· Java 代码 · 共 62 行
JAVA
62 行
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 + =
减小字号Ctrl + -
显示快捷键?