• Post Reply Bookmark Topic Watch Topic
  • New Topic

Listening on Checkbox rendering in JLlist

 
Patrik Nilsson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JList where I have set the cellrenderer to a component that extends checkbox.

What I would like to do now is find out as soon as a user clicks on any item in the list if the checkbox is checked or not checked.

It doesn't help to attach a ListItemListener since I will only find out if the item is selected, not if the checkbox is checked or not checked.

I have also tried to create an instance of my checkboxclass, add an actionlistener to that, and set that instance to the cellrenderer.

Anyone got any ideas that could help me?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ListModel of the JList should have this information. The JList is a painted rendering so there are no components; only an image.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!