How do I select any random index in ComboBoxControl? The setSelectedIndex(int index) method of JComboBox seems to be missing from ComboBoxControl class. I tried hunting in Domain class if it was possible to do it but could not get any hint.
Please let me know how this can be done.
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a reason why setSelectedIndex is absent: the ComboBoxControl does not contain a simple list of items,
it contains a list of couples <code,item description> and the better way to set in the combo a specific item description is to set the related code. The order of codes in list could be changed in the time, so referring an item description by index is not the better way: use ComboBoxControl.setValue(...) method to specify the code to use to select an item!
Anyway, you could use getComboBox() method to access the embedded combo box, as suggested above...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a very basic question here.
How do I select any random index in ComboBoxControl? The setSelectedIndex(int index) method of JComboBox seems to be missing from ComboBoxControl class. I tried hunting in Domain class if it was possible to do it but could not get any hint.
Please let me know how this can be done.
Cheers
there is getComboBox method in comboboxcontrol. you can call getComboBox().setSelectedIndex()
There is a reason why setSelectedIndex is absent: the ComboBoxControl does not contain a simple list of items,
it contains a list of couples <code,item description> and the better way to set in the combo a specific item description is to set the related code. The order of codes in list could be changed in the time, so referring an item description by index is not the better way: use ComboBoxControl.setValue(...) method to specify the code to use to select an item!
Anyway, you could use getComboBox() method to access the embedded combo box, as suggested above...
This seems to sovle my problem.
Thanks & Cheers