-
Enhancement
-
Resolution: Unresolved
-
P5
-
None
-
5.0
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
The methods in DefaultComboBoxModel are somewhat inconsistent in the type of argument & result that they provide.
Some of the methods use the Object as their argument or result (setSelectedItem, getSelectedItem), some use the index (in particular, insertElementAt), and some have both (remove...). I suggest that both types of argument/result be provided, so that there is also setSelectedIndex, getSelectedIndex (which are in JComboBox for some reason).
JUSTIFICATION :
Where the model holds Objects rather than just Strings, setting up temporary Objects to search on is wearisome.
This also makes for inefficient coding, as it means that one has to do a linear search (with lots of calls to equals()) to find the relevant index. I admit that this isn't too bad, as combo boxes don't usually have very many elements. But it's a nuisance and is a candidate for cleaning up.
CUSTOMER SUBMITTED WORKAROUND :
Do a linear search on the model, looking for the relevant object.
The methods in DefaultComboBoxModel are somewhat inconsistent in the type of argument & result that they provide.
Some of the methods use the Object as their argument or result (setSelectedItem, getSelectedItem), some use the index (in particular, insertElementAt), and some have both (remove...). I suggest that both types of argument/result be provided, so that there is also setSelectedIndex, getSelectedIndex (which are in JComboBox for some reason).
JUSTIFICATION :
Where the model holds Objects rather than just Strings, setting up temporary Objects to search on is wearisome.
This also makes for inefficient coding, as it means that one has to do a linear search (with lots of calls to equals()) to find the relevant index. I admit that this isn't too bad, as combo boxes don't usually have very many elements. But it's a nuisance and is a candidate for cleaning up.
CUSTOMER SUBMITTED WORKAROUND :
Do a linear search on the model, looking for the relevant object.