girlmidlet.java

来自「J2ME初学者必作的CANVAS练习」· Java 代码 · 共 35 行

JAVA
35
字号
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class GirlMIDlet extends MIDlet 
	implements CommandListener {  
  private Display display;  

  private GCanvas canvas;//声明SCanvas对象   
  
  public void startApp() {
	if (display==null)
		display = Display.getDisplay(this);	
    if (canvas == null){
      canvas = new GCanvas();
	  Command exitCommand = 
	                new Command("退出", Command.EXIT, 0);
	  canvas.addCommand(exitCommand);
	  canvas.setCommandListener(this);
	}
    display.setCurrent(canvas);    
  }
  
  public void pauseApp() {}
  
  public void destroyApp(boolean unconditional) {}
  
  public void commandAction(Command c, Displayable d) {
    if (c.getCommandType() == Command.EXIT) {
      destroyApp(true);
      notifyDestroyed();
	  return;
    }	
  }
}

⌨️ 快捷键说明

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