• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree with checkbox  RSS feed

Joao Cunha
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks!

I am looking for some sample codes to add nodes into JTree, where
the nodes could be "JCheckbox with Label" or "Label only". When clicking
on a button, only the nodes with the check in the JCheckbox are

I created my own cell renderer, then getCellRendererComponent is return JCheckBox on the node that the check box would appear, otherwise return normal JLabel.
It worked but the node is not checkable...
The other problem that I faced is that the icons of the node (like folder file) that comes in the JTree, by default, is not appearing anymore. It's appearing only the check-boxes...

the result should appear like that of eclipse import file system tree, for example...

Thanks for the help
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!