⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hello.java

📁 Java版PRG游戏——跳动的牛仔
💻 JAVA
字号:
package net.frog_parrot.hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;


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);


  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();
  }
  
 
  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -