import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Exec extends MIDlet implements CommandListener {
Display display;
TextBox textBox;
Command cmd1 = new Command("显示", Command.ITEM, 1);
public void startApp() {
display = Display.getDisplay(this);
textBox = new TextBox("编辑", "初始值", 50, TextField.ANY);
textBox.addCommand(cmd1);
textBox.setCommandListener(this);
display.setCurrent(textBox);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
Alert alert = new Alert("显示");
alert.setString(textBox.getString());
alert.setTimeout(2000);
display.setCurrent(alert);
}
}
[此贴子已经被作者于2010-12-12 18:27:49编辑过]