LWUIT获得组合框选择

时间:2013-09-09 06:11:33

标签: java java-me lwuit lwuit-resource-editor

我是LWUIT的新手。我使用资源编辑器创建了一个主题并生成了一个代码。在用户选择县的表单中,然后按下继续命令。如何获取用户使用该命令选择的内容以及如何在获取用户所在国后显示下一个表单?我之前没有使用StateMachine.java和StateMachineBase.Java下面是我的命令代码,但我不知道该怎么叫。

    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 个答案:

答案 0 :(得分:1)

我建议迁移到Codename One,这会得到更好的支持。

使用类似:

 int selectedIndex = findMyComboBoxName().getSelectedIndex();
 Object selectedValue = findMyComboBoxName().getSelectedItem();
相关问题