/* * File name: FormMidlet.java */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * @author Daniel Siagian */ public class FormMidlet extends MIDlet implements CommandListener{ Display display; public Command keluar=new Command("Keluar",Command.EXIT,0); public Form form=new Form("Contoh form"); public TextField tf1=new TextField(null,null,32,TextField.ANY); public void startApp() { if (display==null) display=Display.getDisplay(this); form.append("Aplikasi mobile"); form.append("dibuat dengan java"); form.append("\noleh :"); form.append("\nDaniel Siagian"); form.append("-------------"); form.append("Nama :"); form.append(tf1); TextField tf2=new TextField(null,null,32,TextField.EMAILADDR); form.append("Email :"); form.append(tf2); TextField tf3=new TextField(null,null,32,TextField.NUMERIC); form.append("Umur :"); form.append(tf3); TextField tf4=new TextField(null,null,32,TextField.PHONENUMBER); form.append("Telpon :"); form.append(tf4); TextField tf5=new TextField(null,null,32,TextField.URL); form.append("Alamat Web :"); form.append(tf5); TextField tf6=new TextField(null,null,32,TextField.DECIMAL); form.append("DECIMAL :"); form.append(tf6); form.addCommand(keluar); form.setCommandListener(this); display.setCurrent(form); } public void commandAction(Command cmd, Displayable d){ System.out.print(cmd.toString()); if (cmd==keluar) { destroyApp(true); notifyDestroyed(); } } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }