File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTree not desplaying and check boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree not desplaying and check boxes" Watch "JTree not desplaying and check boxes" New topic

JTree not desplaying and check boxes

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
hey all

thought i would give JTrees ago as i have no idea how to use them correctly..

in this project i am using netbeans and created a jTree but i wanted to add in check box's aswell but not come across this before have look over examples and tut's for 2 days now and not sure what way to go now...

i gave up on the IDE JTree and went with a scrollpane and cellrender but it doesn't display in the scrollpane??

then i was going to add in this to get the checkboxes in there..

any guides or guidence will be great many thanks......

i did try the treemodel but cant get checkboxes in it...

Paul Clapham

Joined: Oct 14, 2005
Posts: 19891

Here's something I found after a bit of googling: CheckBox Node Tree Sample.

It's a lot more complex than your attempt, but on the other hand it's possible it is too complex. We don't know anything about the age of that page; some things used to be hard to do back in 2002 but are easier now. This might be one of those things but as I said, I don't know.

If you only need the checkboxes to be read-only (you didn't mention whether you do or not) then you could leave out the CellEditor part.
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
cool thanks will give it a look over... i just want to be able select the checkbox then read what was selected...
I agree. Here's the link:
subject: JTree not desplaying and check boxes
It's not a secret anymore!