private Form getForm() { Form form = new Form("test"); ChoiceGroup choice = new ChoiceGroup(null, ChoiceGroup.EXCLUSIVE); choice.append("Male", null); choice.append("Female", null); form.append(choice); this.cmdSelect = new Command("Select", Command.OK, 1); form.addCommand(this.cmdSelect); form.setCommandListener(this); return form; }
form.addCommand(add);
protected void startApp() throws MIDletStateChangeException { // TODO Auto-generated method stub Display.init(this); // For hide the form title bar. It is working in Nokia asha 501. Display.getInstance().setForceFullScreen(true); Display.setObjectTrait(Display.getInstance().getImplementation(), "nokia.ui.canvas.status_zone", Boolean.TRUE); Form a = new Form("form"); a.addCommand(new Command("exit"),0); a.addCommand(new Command("HELP"),1); a.addCommand(new Command("ABOUT"),2); a.setEnabled(true); a.show(); }
import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class SmokeTest extends MIDlet { protected void startApp() { Display display = Display.getDisplay(this); Form form = new Form("form"); form.addCommand(new Command("Exit", Command.EXIT, 1)); form.setCommandListener(new CommandListener() { public void commandAction(Command c, Displayable d) { notifyDestroyed(); } }); display.setCurrent(form); } protected void pauseApp() { } protected void destroyApp(boolean unconditional) { notifyDestroyed(); } }
textField = new TextField("", "", 250, TextField.ANY); form.addCommand(cmdExit); form.addCommand(cmdSetConstraints); form.append(textField);
formA.addCommand(formA_next); formA.setCommandListener(new CommandListener() { formB.addCommand(formB_back); formB.setCommandListener(new CommandListener() {
javax.microedition.lcdui.Command.OK, 0); final javax.microedition.lcdui.Command cancelCommand = new javax.microedition.lcdui.Command(UIManager.getInstance().localize(CANCEL, CANCEL), javax.microedition.lcdui.Command.CANCEL, 0); dateForm.addCommand(acceptCommand); dateForm.addCommand(cancelCommand); CommandListener commandListener = new CommandListener() { public void commandAction(javax.microedition.lcdui.Command command, Displayable displayable) {
form.addCommand(exit); form.addCommand(submit); form.append(textfield); form.setCommandListener(this);
decr= new Command("Decrease",Command.EXIT,1); incr= new Command("Increase",Command.EXIT,1); frm.addCommand(exit); frm.addCommand(decr); frm.addCommand(incr);
mainForm.addCommand(exitCommand); mainForm.setCommandListener(this); Display.getDisplay(this).setCurrent(mainForm);
formReceiver.addCommand(cmdListen); formReceiver.addCommand(cmdExit); formReceiver.setCommandListener(this);
exit = new Command("Exit", Command.EXIT, 1); form.append(imageItem); form.addCommand(exit); form.setCommandListener(this); display.setCurrent(form);
formSender.append(tfPort); formSender.append(tfMessage); formSender.addCommand(cmdSend); formSender.addCommand(cmdExit); formSender.setCommandListener(this);
chooseDB(c.getComponentForm()); private void chooseDB(final Form main) { Form f = new Form("Choose a Database"); ... Command backCommand = new Command("Back") { public void actionPerformed(ActionEvent ev) { main.showBack(); }}; f.addCommand(backCommand); f.setBackCommand(backCommand); f.show(); }
f.addCommand(exitCommand); f.setBackCommand(exitCommand);
form.addCommand(exit); form.setCommandListener(this); display.setCurrent(form);
MainForm = new Form("MainForm"); okCommand = new Command("Ok", Command.OK, 0); MainForm.addCommand(okCommand); MainForm.setCommandListener(this);
public static String showInputDialog(final MyCallBack callback) { Form frm = new Form(); final Command cmd = new Command("Ok"); final TextField txt = new TextField("Enter the text", null, 1024, 0); frm.addCommand(cmd); frm.append(txt); frm.setCommandListener(new CommandListener() { public void commandAction(Command c, Displayable d) { if (c == cmd) { return callback.processResult(txt.getString()); } else { return; // or just omit the else part } } }); }
Button b = new Button("Clickme"); b.setActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Form f = new Form(); Container c = new Container(); Command backCommand = new Command("Settings") { public void actionPerformed(ActionEvent ev) { b.getComponentForm().showBack(); }}; f.addCommand(backCommand); f.setBackCommand(backCommand); f.addComponent(c); f.show(); } });