📄 sl.java
字号:
/*
* 好好学习,天天向上。
*
* 作者: 牛潇
* MSN: niuxiao@msn.com
* E-Mail: gniuxiao@gmail.com
* QQ: 19528689
*
* 创建日期: 2006-2-20
*/
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
/**
* 主程序
*
* @author 牛潇
*/
public class sl extends MIDlet implements CommandListener
{
private Display display;
private slCanvas canvas;
private Command exitCmd, restartCmd;
public sl()
{
this.display = Display.getDisplay(this);
this.canvas = new slCanvas();
this.exitCmd = new Command("Exit", Command.EXIT, 1);
this.restartCmd = new Command("Restart", Command.SCREEN, 1);
canvas.addCommand(exitCmd);
canvas.addCommand(restartCmd);
canvas.setCommandListener(this);
}
/**
* @see javax.microedition.midlet.MIDlet#startApp()
*/
protected void startApp() throws MIDletStateChangeException
{
display.setCurrent(canvas);
startGame();
}
/**
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp()
{
}
/**
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
}
/**
* @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)
*/
public void commandAction(Command c, Displayable d)
{
if (c == exitCmd) {
try {
destroyApp(false);
}
catch (MIDletStateChangeException ex) {
ex.printStackTrace();
}
notifyDestroyed();
}
else if (c == restartCmd)
startGame();
}
private void startGame()
{
canvas.startNewGame(new slController(11,11,20));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -