Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Forcing a JComboBox to stay open Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Forcing a JComboBox to stay open" Watch "Forcing a JComboBox to stay open" New topic

Forcing a JComboBox to stay open

James JVogt

Joined: May 21, 2007
Posts: 6
First off: I have made a JComboBox that contains JCheckBox components inside of it
when it is expanded.

The ideal situation would be for a user to open the combobox, check off all the options they want, and then click somewhere else on the gui to make the combo box collapse.

The current situation is this:
the user opens the combo box, checks off an option and then the combo box immediately collapses so if they would like to check off another option they must open the combo box again.

I need to force the combo box to stay open until the user clicks another area of the gui.
[ May 21, 2007: Message edited by: Matt Crinklaw ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You might be better off building a custom component rather than either fighting with
JComboBox or writing/extending plaf code to change the behavior.
You could make a JButton that shows a JList (in a JWindow set just below the button) that
can take multiple selections. You could change the text on the button and use it for the
close/apply/all_finished_with_selections part.
I agree. Here's the link:
subject: Forcing a JComboBox to stay open
jQuery in Action, 3rd edition