Jcombobox with Jcheckboxes

82 views Asked by At

how can I create (with JAVA) Combobox that contains Checkboxes for multiple selection and display the selected items in the Combobox like this picture:
click to see the pic

and thnx for advance.
EDIT:
I found this API (JAPURA API) and it's great but when I select multiple things I want to display the selected items instead of "* multiple items *".

2

There are 2 answers

3
Naruto Biju Mode On

Here's the link to achieve your goal: JComboBox Providing a Custom Renderer

2
clockw0rk On

I would suggest you create a JButton and style it in the form of a Combobox if you want that.

Then, at the onclick function (actionperformed), you create a JPanel and make it visible under the button. In the panel, you can put whatever you want, so you just put checkboxes there.

I know this is kind of a workaround of your problem, but it should be easy for you to do so, and the actual user does not see a difference at all.

Hope I could help you.

Cheers,

Lucky