Is there a comparable mechanism to the .NET “set DisplayMember” for the JListBox Swing component?
Overriding the toString() method is not sufficient because I also want to be able to change the display member at runtime.
I also looked into implementing my own ListCellRenderer, but found it not very convenient.
Ist there a easier or more elegant approach?
Thanks for your time.
I came up with a satisfying solution based on implementing a custom
ListCellRenderer.In your client GUI code you can do something like this: