I'm using the AutoCompletion on a combo box, and when it is uneditable, it still allows me to search, which is nice. But, it looks like it is searching on the actual element values, and not the rendered values when using a custom renderer.
So for example, if I have a combo box of a Person object, and the combo box renders the object using the person.name, the combo box might look something like
Bill
Joe
Tom
But, when trying to use search, since the objects in the combo box are actually Person objects and not strings, the search will not find them. Is there a way to use the rendered value for searching, since that is what the user will see?
Note: I have been able to make this work by overriding convertElementToString, getting the renderer from the combo, and rendering the value to determine what the rendered value is, but this is not a 100% solution, since I have to try to get the text from the list cell component by checking what kind of component it is and calling the correct method (e.g. if it's a JLabel, call ((JLabel)component).getText())
Thanks,
Jeff