wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTree with checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree with checkbox" Watch "JTree with checkbox" New topic
Author

JTree with checkbox

Joao Cunha
Greenhorn

Joined: Jul 12, 2004
Posts: 24
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
printed.

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree with checkbox