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.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class TextFieldMIDlet extends MIDlet implements CommandListener {
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private TextField aTextField = new TextField("Label", "Content", 4, TextField.ANY);
private Display display = Display.getDisplay(this);
public TextFieldMIDlet() {
}
public void startApp() {
Form aForm = new Form("TextField");
aForm.append(aTextField);
aForm.addCommand(exitCommand);
aForm.setCommandListener(this);
display.setCurrent(aForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}