hello.java
来自「Java版PRG游戏——跳动的牛仔」· Java 代码 · 共 64 行
JAVA
64 行
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 + =
减小字号Ctrl + -
显示快捷键?