• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree with Checkbox Nodes  RSS feed

 
lenin laker
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts,

I want to develop a Jtree which is having checkbox to every node and label. When user selects a child node then the parent nodes checkbox should also be selected partially.

This tree should look like the tree we see many times in windows based applications.

I wonder how can I do this?.. Please help me in this..

Thanks and Regards,
Lenin
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be aware of how Swing treats its components. In many cases (JTable, JList, JTree) it uses the renderer/editor model. The renderer is a custom read-only presentation of your info. The editor is a custom writable presentation of your info. This is the way to solve your problem. You should read more about this in Sun Swing Tutorial.

--
./pope
[the_mindstorm]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this might start you off

http://forum.java.sun.com/thread.jsp?forum=57&thread=122006
 
Siripa Siangklom
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TreeCellRenderer is your choice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!