//package BallGame;
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;
/**
* <strong>FileName</strong>: BallMidlet.java
* <HR>
* <strong>Description</strong>: Basic MIDlet application structure.
* <P><HR>
* @author
* <em>
* This Game is developed by <B>Fansy</B>.<BR>
* F.S.Studio 1999~2005
* </em>
* @version 0.3.2
*/
public class BallMidlet extends MIDlet implements CommandListener
{
private Command exitCommand; //退出命令
private BallCanvas canvas; //画布对象
public static BallMidlet instance;
public BallMidlet()
{
instance=this;
canvas=new BallCanvas(); //建立画布
exitCommand=new Command("EXIT",Command.EXIT,1); //建立退出命令
canvas.addCommand(exitCommand); //添加命令
canvas.setCommandListener(this); //设定命令响应
}
protected void startApp()
{
Display.getDisplay(this).setCurrent(canvas); //设定程序开始时的显示对象
canvas.start();
}
protected void pauseApp()
{
}
protected void destroyApp(boolean unconditional)
{
}
public void quitApp()
{
destroyApp(false);
notifyDestroyed();
}
public void commandAction(Command c,Displayable d)
{
if(c==exitCommand) //当监测到退出命令时退出程序
{
quitApp();
}
}
}