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.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class MIDletSampleMain extends MIDlet implements CommandListener {
private Form mainForm;
private TextField inputTextBox;
private StringItem outputLabel;
private Command endCmd = new Command("I¹", Command.EXIT, -1);
private Command copyCmd = new Command("Rs[", Command.ITEM, 1);
public MIDletSampleMain(){
mainForm = new Form("MIDletSample");
inputTextBox = new TextField("üÍàe", "", 200, TextField.ANY);
outputLabel = new StringItem("õ", "x");
mainForm.addCommand(endCmd);
mainForm.addCommand(copyCmd);
mainForm.append(inputTextBox);
mainForm.append(outputLabel);
mainForm.setCommandListener(this);
}
protected void startApp() {
Display.getDisplay(this).setCurrent(mainForm);
}
public void commandAction(Command c, Displayable d) {
if (c == endCmd) {
notifyDestroyed();
} else if (c == copyCmd) {
outputLabel.setText(inputTextBox.getString());
}
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}