hello.java

来自「JAVASCRIPT的界面说明JAVASCRIPT的界面说明JAVASCRIPT」· Java 代码 · 共 72 行

JAVA
72
字号
package net.frog_parrot.hello;import javax.microedition.midlet.*;import javax.microedition.lcdui.*;/** * This is the main class of the hello world demo. * * @author Carol Hamer */public class Hello extends MIDlet implements CommandListener {  Display myDisplay;  HelloCanvas myCanvas;  private Command exitCommand = new Command("Exit", Command.EXIT, 99);  private Command newCommand = new Command("Toggle Msg", Command.SCREEN, 1);  /**   * Initialize the canvas and the commands.   */  public Hello() {    myDisplay = Display.getDisplay(this);    myCanvas = new HelloCanvas(myDisplay);    myCanvas.addCommand(exitCommand);    myCanvas.addCommand(newCommand);    myCanvas.setCommandListener(this);  }  //----------------------------------------------------------------  //  implementation of MIDlet  /**   * Start the application.   */  public void startApp() throws MIDletStateChangeException {    myCanvas.start();  }    /**   * Does nothing.   */  public void destroyApp(boolean unconditional)       throws MIDletStateChangeException {  }  /**   * Does nothing.   */  public void pauseApp() {  }  //----------------------------------------------------------------  //  implementation of CommandListener  /*   * Respond to a command issued on the Canvas.   * (either reset or exit).   */  public void commandAction(Command c, Displayable s) {    if(c == newCommand) {      myCanvas.newHello();    } else if(c == exitCommand) {      try {	destroyApp(false);	notifyDestroyed();      } catch (MIDletStateChangeException ex) {      }    }  }  }

⌨️ 快捷键说明

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