LWUIT Get combobox selection

182 views Asked by At

I'm a nwebie in LWUIT. I have created a theme using the resource editor and generated a code. In the form the user selects the county then presses a continue command. How do I get what the user selected using the command and how do I show the next form after getting the user country? I've not worked with StateMachine.java before and StateMachineBase.Java Below is my code for the command but I have no idea what to call.

    package userclasses;

    import com.sun.lwuit.Container;
    import generated.StateMachineBase;


    public class StateMachine extends StateMachineBase {

        public StateMachine(String resFile) {
            super(resFile);
            // do not modify, write code in initVars and initialize class members there,
            // the constructor might be invoked too late due to race conditions that might occur       
        }

        /**
         * this method should be used to initialize variables instead of the
         * constructor/class scope to avoid race conditions
         */
        protected void initVars() {

            String username;
        }

        protected boolean onGetUserCountryFormContinue() {
            // If the resource file changes the names of components this call will break notifying you that you should fix the code
            boolean val = super.onGetUserCountryFormContinue();
//I should get the user selection here after the command has been selected.           

            return val;
        }
    }
1

There are 1 answers

0
Shai Almog On BEST ANSWER

I suggest migrating to Codename One which is better supported.

Use something like:

 int selectedIndex = findMyComboBoxName().getSelectedIndex();
 Object selectedValue = findMyComboBoxName().getSelectedItem();