开发者

how to get selected item of combo box

开发者 https://www.devze.com 2023-03-22 21:36 出处:网络
i\'m using lwuit with j2me . how to get combo box selected item or index? i found the function for setSelec开发者_如何转开发tedIndex but not for getting the selected.Use this code :

i'm using lwuit with j2me . how to get combo box selected item or index? i found the function for setSelec开发者_如何转开发tedIndex but not for getting the selected.


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


To get what you selected as a string:

String selected_text = ComboBox.getItemAt(ComboBox.getSelectedIndex());
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号