This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
Hi. Can anyone help me figure out how I can disable certain items on a JComboBox? I know I need a customer renderer which I am using one for setting tool tips on my items, however, I can't seem to figure out how to disable certain items so the user cannot select them. Here's my custom renderer:
Thanks for any help! [ October 01, 2002: Message edited by: Jennifer Sohl ]
posted 13 years ago
I don't know exactly how you can do it but here is what I think. Search in the JComboBox's ActionMap the action responsible with item selection. Save it. Make your own select action that filter the items as you want and for those that satisfy the filter call the saved action, for the others don't. This is along with that custom renderer that you have to mark the disabled items. Hope it helps, Remus