📄 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();//退出
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -