/*
* Midlet.java
*
* Created on 2008年9月17日, 上午10:49
*/
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;
/**
*
* @author Administrator
* @version
*/
public class Exec extends MIDlet implements CommandListener {
Display display = Display.getDisplay(this);
Form form1 = new Form("表单1");
Form form2 = new Form("表单2");
Command cmd11 = new Command("退出", Command.EXIT, 1);
Command cmd12 = new Command("下一个", Command.BACK, 1);
Command cmd21 = new Command("退出", Command.EXIT, 1);
Command cmd22 = new Command("上一个", Command.BACK, 1);
public void startApp() {
form1.addCommand(cmd11);
form1.addCommand(cmd12);
form1.setCommandListener(this);
display.setCurrent(form1);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command cmd, Displayable arg1) {
if (cmd.equals(cmd11) || cmd.equals(cmd21)) {
display.setCurrent(new Form("Null"));
} else if (cmd.equals(cmd12)) {
form2.addCommand(cmd21);
form2.addCommand(cmd22);
form2.setCommandListener(this);
display.setCurrent(form2);
} else if (cmd.equals(cmd22)) {
display.setCurrent(form1);
}
}
}
[此贴子已经被作者于2010-12-12 18:26:59编辑过]