2013-09-09 2 views
0

Я - nwebie в LWUIT. Я создал тему с помощью редактора ресурсов и сгенерировал код. В форме пользователь выбирает графство, а затем нажимает команду continue. Как получить то, что пользователь выбрал с помощью команды, и как я могу показать следующую форму после получения пользовательской страны? Я не работал с StateMachine.java до и StateMachineBase.Java Ниже мой код для команды, но я понятия не имею, что звонить.LWUIT Получить подборку

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

Предлагаю перейти на Codename One, который лучше поддерживается.

использовать что-то вроде:

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