import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class DemoTextField extends MIDlet
implements CommandListener {
private Display display;
private Form form;
private TextField nama, password, telp, email, URL;
private final Command cmdKeluar =
new Command("Keluar", Command.EXIT, 1);
public DemoTextField() {
display = Display.getDisplay(this);
}
public void startApp() {
form = new Form("Demo TextField");
nama = new TextField("Nama:", null, 25, TextField.ANY);
password = new TextField("Password:", null, 25,
TextField.PASSWORD);
email = new TextField("Email:", null, 50,
TextField.EMAILADDR);
URL = new TextField("URL:", null, 50, TextField.URL);
telp = new TextField("Telepon:", null, 15,
TextField.PHONENUMBER);
form.append(nama);
form.append(password);
form.append(email);
form.append(URL);
form.append(telp);
form.addCommand(cmdKeluar);
form.setCommandListener(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar) {
destroyApp(false);
notifyDestroyed();
}
}
}
No comments:
Post a Comment