import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class textField extends MIDlet implements CommandListener { private Form form, form1; private Display tampilan; private TextField nama, alamat; private Command ok, keluar, kembali; public textField() { nama = new TextField("Nama:", "", 30, TextField.ANY); alamat = new TextField("Alamat Rumah:", "", 30, TextField.ANY); ok = new Command("OK", Command.OK, 2); keluar = new Command("keluar", Command.EXIT,1); form1 = new Form("Aplikasi pendataan"); form1.append(nama); form1.append(alamat); form1.addCommand(ok); form1.addCommand(keluar); form1.setCommandListener(this); } public void startApp() { tampilan = Display.getDisplay(this); tampilan.setCurrent(form1); } public void pauseApp() { } public void destroyApp(boolean destroy){ notifyDestroyed(); } public void showInput(){ String n = nama.getString(); String c = alamat.getString(); form = new Form("Data Pelanggan"); form.append("Nama : "+n+"\nAlamat : "+c); Display.getDisplay(this).setCurrent(form); form.addCommand(new Command("kembali", Command.BACK, 2)); form.setCommandListener(this); } public void commandAction(Command c, Displayable d) { String label = c.getLabel(); if(label.equals("keluar")) notifyDestroyed(); else if(label.equals("OK")) showInput(); else if(label.equals("kembali")) startApp(); } }
Rabu, 31 Oktober 2012
Penggunaan TextField
TextField untuk memasukkan sebuah karakter
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar