0

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 *".

Slim EN
  • 145
  • 2
  • 3
  • 9
  • See the following link [JComboBox Providing a Custom Renderer](https://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#renderer) – Naruto Biju Mode Nov 16 '14 at 15:30

2 Answers2

0

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

Naruto Biju Mode
  • 2,011
  • 3
  • 15
  • 28
  • thnx but this is not what I want. I want to display the items of combobox as checkboxes and display the selected items on the combobox – Slim EN Nov 17 '14 at 18:09
  • @SlimEN do you mean combobox with checkboxs items, and when you check an item from the combobox it will be displayed on another list ? (i mean two components the first is combobox with checkbox items and another list which contains the selected items from the combobox ?) – Naruto Biju Mode Nov 17 '14 at 21:02
  • I want to make it like this photo: http://img15.hostingpics.net/pics/644480Sanstitre.png – Slim EN Nov 18 '14 at 17:58
0

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

clockw0rk
  • 576
  • 5
  • 26
  • is that mean that there is no way to create a combobox with checkboxes ? – Slim EN Nov 17 '14 at 18:08
  • no, it's not meant you cannt do this, this was just a suggestion to workaround your problem. i hope you can solve this and tell us how you did it. – clockw0rk Nov 17 '14 at 21:20