Hi, I want to make a JTree with checkboxes. The checkbox selection should be independent of the node selection. i.e. if I click on the node's text part it should be highlighted but the check box should not be ticked/unticked. Ticking/unticking the checkbox should not highlight the node's text part.
Actually when the GUI comes up for the first time i read the file system of a system and displays only the first level, say only the C: drive and its folders in the left pane as tree and on right side pane the files present in C drive in a tabular structure.
Now when i click on the node's text part, node should be highlited and it should fetch the content of the folder and add the subfolders to it and so on. This means I am adding the child nodes on user click. May be I can have a FolderUserObject which can save the tick/untick as a boolean variable, as i need this at later part.
Please provide me some good sample code soon. Its very urgent. Thanks in advance.
Joined: Nov 30, 2004
I recently researched this topic. Googling 'jtree checkbox' returned many results. I found this example to be very useful. [ June 08, 2007: Message edited by: Bridget Kennedy ]
Joined: Jun 08, 2007
Problem with this example code is it checks box is not there for the parent nodes. Can somebody correct this so that i should have checkboxs through out the tree but the behaviour of the checkbox should ramain same.
Is it possible to remove the if(leaf) check in the renderer?
Please provide me the solution. Thanks in advance.