【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了TransformDemo.java相关资料,希望对各位网友有所帮助!
// Any use of this code and/or information below is subject to the
// license terms: http://wireless.java.sun.com/berkeley_license.html
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class TransformDemo extends MIDlet implements CommandListener {
private MyCanvas myCanvas; //声明MicroTankCanvas
public void startApp() //开始
程序 {
if (myCanvas == null)
{
try {
myCanvas = new MyCanvas();//构造实例,注意,之前要判断
myCanvas.start(); //调用start函数
Command exitCommand = new Command("Exit", Command.EXIT, 0);//添加exit按键
myCanvas.addCommand(exitCommand);
myCanvas.setCommandListener(this);
}
catch (IOException ioe)
{
System.out.println(ioe);
}
}
Display.getDisplay(this).setCurrent(myCanvas);//设置display
}
public void pauseApp() {}
public void destroyApp(boolean unconditional)
{
if (myCanvas != null)
myCanvas.stop();//调用stop函数
}
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) {
destroyApp(true);
notifyDestroyed();//退出
}
}
}