how to get selected item of combo box
Asked Answered
I

2

7

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.

Indochina answered 25/7, 2011 at 10:18 Comment(0)
P
23

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

Perfunctory answered 26/7, 2011 at 6:39 Comment(2)
thanks bharath. may i know the citation please. because i'm very much struggle to find the documentationIndochina
@Paniyar: look at here, LWUIT Java documentation..Perfunctory
D
3

To get what you selected as a string:

String selected_text = ComboBox.getItemAt(ComboBox.getSelectedIndex());
Doublespace answered 17/3, 2017 at 20:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.