GWT listbox - how to search element index using text?

Do I need to look up the index number of an item using the item text in the GWT list?

+2
source share
1 answer

No, you need to go through them and find this index yourself.

Like this:

String text = "listBoxText"; int indexToFind = -1; for (int i=0; i<listBox.getItemCount(); i++) { if (listBox.getItemText(i).equals(text)) { indexToFind = i; break; } } 
+5
source

All Articles