import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
public class Exec extends MIDlet implements CommandListener {
private Display display;
Form f = new Form("HelloTest");
private Command cmd;
// 构造函数
public Exec() {
display = Display.getDisplay(this);
cmd = new Command("暂停", Command.SCREEN, 2);
f.addCommand(cmd);
f.setCommandListener(this);
display.setCurrent(f);
System.out.println("Constructor");
}
public void startApp() {
System.out.println("startApp is called.");
}
public void pauseApp() {
System.out.println("pauseApp is called.");
}
public void destroyApp(boolean unconditional) {
System.out.println("destroyApp is called.");
}
public void commandAction(Command c, Displayable s) {
System.out.println("commandAction");
pauseApp();
notifyPaused();
}
}
[此贴子已经被作者于2010-12-12 18:23:08编辑过]