m3gmidlet.java

来自「Java ME手机应用开发大全一书的配套光盘上的源码」· Java 代码 · 共 47 行

JAVA
47
字号
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;

public class M3GMidlet extends MIDlet implements CommandListener
{
	private Display display = null;
	// 定义3D画布
	private M3GCanvas canvas = null;
	private static MIDlet self = null;

	protected void startApp() throws MIDletStateChangeException
	{
		display = Display.getDisplay(this);
		canvas = new M3GCanvas(30);
		canvas.addCommand(new Command("Quit", Command.EXIT, 1));
		canvas.setCommandListener(this);
		//调用绘制的启动方法
		canvas.start();
		display.setCurrent(canvas);
		self = this;
	}

	protected void pauseApp()
	{
		
	}

	protected void destroyApp(boolean unconditional) throws MIDletStateChangeException
	{
		notifyDestroyed();
	}

    public void commandAction(Command c, Displayable d) {
        if(c.getCommandType() == Command.EXIT)
            notifyDestroyed();
    }

    public static void die()
    {
        self.notifyDestroyed();
    }
}

⌨️ 快捷键说明

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