[mobility] Using a Textfield to switch to displayables

  • From: "The_Mace" < >
  • To:
  • Subject: [mobility] Using a Textfield to switch to displayables
  • Date: Thu, 27 Dec 2012 14:04:44 -0500

I'm working with java me, I built an app using forms displayables. I'm trying 
to switch to other forms, based on the user's input in a textfield item. For 
example, I want the user to be able to type in the number "1" in the 
textfield and then be taken to form1 or type in "2" and be taken to form2 etc.

Here's what I did.

I added a command to the textfield item and listen on it to read textfield 
contents and then compare the contents as a string, to switch forms. I don't 
know why my code isn't working. I think maybe there's something I'm missing 
or my logic is not right. I'd really appreciate any help on this please.


            form.setCommandListener(new CommandListener() {
                
                public void commandAction(Command command, Displayable 
displayable) {
                    if (command == getTextFieldItemCommand()) {
                        if ("1".equals(TextField.getString())) {
                            switchDisplayable(null, form1);
                        } else if ("2".equals(TextField.getString())){
                            switchDisplayable(null, form2);
                        }
                    }
                }






[mobility] Using a Textfield to switch to displayables

The_Mace 12/27/2012

Project Features

About this Project

Mobility was started in November 2009, is owned by dstrupl, and has 40 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150626.29986a4). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close