I have got a Listbox and i want to add some Items. There are only methods to add items as a String, but I want add a Item to the Listbox with a String and a reference to an Object. So that, if a item was selected in the Listbox, I get the Object reference too. Otherwise I have always to search with equal for the right Object.
Is there any option therefore?
Try ValueListBox
instead of ListBox
.
You could store the object in a Map indexed by the value of the item, or in an array or List, at the index of the added item in the list box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With