aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Disable items on JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Disable items on JComboBox" Watch "Disable items on JComboBox" New topic
Author

Disable items on JComboBox

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
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 ]
Remus Stratulat
Greenhorn

Joined: Jan 29, 2002
Posts: 14
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


strem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable items on JComboBox
 
Similar Threads
JComboBox and "long" items rendered via HTML
Regarding JComboBox in a JTable
JTable with Drop down issue.
Color in JComboBox
List with checkboxes