I am using the DefaultComboBoxModel to display a list of customers in a ComboBox. The list currently displays their name only. I would also like to have a reference to each customer within the DefaultComboBoxModel so that when a name is selected, it also holds the reference to the real customer object.
To achieve this, I suspect I have to extend the DefaultComboBoxModel and possibly override the addElement method? Or can I just add a new method that can also store my references to customers? If so, do I have to look at the source code for DefaultComboBoxModel to see how it stores the elements? Sorry if this question is confusing but I can't figure out how to do it the right way. Thanks for reading.