java-mecomboboxlwuit

how to get selected item of combo box


i'm using lwuit with j2me . how to get combo box selected item or index? i found the function for setSelectedIndex but not for getting the selected.


Solution

  • Use this code :

    comboBox.getSelectionModel().getSelectedIndex(); 
    

    To return the current selected offset in the list.

    comboBox.getSelectionModel().getSelectedItem(); 
    

    To return the current selected item in the list or null for no selection