Reputation: 21076
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.
Upvotes: 7
Views: 84469
Reputation: 14473
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
Upvotes: 23
Reputation: 51
To get what you selected as a string:
String selected_text = ComboBox.getItemAt(ComboBox.getSelectedIndex());
Upvotes: 3