File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Checked JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checked JComboBox" Watch "Checked JComboBox" New topic

Checked JComboBox

Laurent Saudmont

Joined: Jul 05, 2002
Posts: 5
I would like to create a JComboBox with JCheckBox as item in the combobox.
Is it possible? How can i do that?
Great thanks for your response
Neil Marsden

Joined: May 31, 2002
Posts: 6
Is using a JCheckBoxMenuItem an option?
A JMenu is, for all intensive purposes, a comboBox
and can be placed in a JPanel nested within a JMenuBar.
I suppose the more difficult approach would be to extend the JComboBox class...?
Laurent Saudmont

Joined: Jul 05, 2002
Posts: 5
Indeed, i don't see how i can extend this to a combobox...
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

You should be making custom ListCellRenderers and ComboBoxEditors to make a check box appear in a Combo box...

Here is some example code of how to do this...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Checked JComboBox
jQuery in Action, 3rd edition