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 Components inside 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 "Components inside JComboBox" Watch "Components inside JComboBox" New topic

Components inside JComboBox

Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 661

I need to have a JComboBox in this fashion. On selecting the drop down,

checkbox1 text1
checkbox2 text2
checkboxn textn

should be displayed.

Iam very new to Swing/Awt UI stuff and I figured out that I need to add a component inside the JCombobox I create. I Don't know if I can achieve this by adding a JCheckBox component or I need to create a JPanel for this.

I have created many JCheckBox components and tried to add it and display but nothing was visible inside the JComboBox I created. I don't know how to change the default renderer for the JComboBox and make it render this kind of JComboBox.

Please take a look at the code I have written.

Any Help would be deeply appreciated and please forgive me if my code was dumb.
[ June 02, 2006: Message edited by: Arun Kumarr ]

If you are not laughing at yourself, then you just didn't get the joke.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 661

Thanks Craig.
You have made me watch the climax. I'll have to find out how exactly the renderer is working. :roll:
I agree. Here's the link:
subject: Components inside JComboBox
It's not a secret anymore!