gamemidlet.java

来自「战旗开发」· Java 代码 · 共 47 行

JAVA
47
字号
package FightChess;
//Download by http://www.codefans.net
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class GameMIDlet extends MIDlet implements CommandListener
{
	private Display display;
	private MyGameCanvas mgc;
	public GameMIDlet()
	{
		display = Display.getDisplay(this);
	}
	public void startApp()
	{
		if(mgc==null)
		{
			mgc=new MyGameCanvas();
			mgc.addCommand(new Command("Start",Command.OK,1));
			mgc.addCommand(new Command("EXIT",Command.EXIT,2));
			mgc.setCommandListener(this);
			display.setCurrent(mgc);
		}
		display.setCurrent(mgc);
	}
	public void pauseApp()
	{
	}
	public void destroyApp(boolean unconditional)
	{
		mgc.exit();
		notifyDestroyed();
	}	
	public void commandAction(Command c,Displayable s)
	{
		String cmd = c.getLabel();
		if(cmd.equals("Start"))
		{
			mgc.start();
		}
		else if(cmd.equals("EXIT"))
		{
			mgc.exit();
			notifyDestroyed();
		}
	}
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?