I want to know how to display tree node values in another jscrollpane using jsplitpane. for this i need to add tree selection listner, so that when i click on node its contents or child nodes should be displayed in second jscroll pane how to do that???
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
add a new JTree with the original tree's selection as the root?
Narendra kodli
Greenhorn
Joined: Dec 24, 2011
Posts: 22
posted
0
Thanks for the reply,
I did accordingly and its displaying original tree structure, but i want to display only the node contents on which i click in new jscrollpane. just like we do in windows manage option.
luck, db
There are no new questions, but there may be new answers.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> but i want to display only the node contents on which i click in new jscrollpane.
just tried it, and it works fine (but didn't use a treeSelectionListener)
Narendra kodli
Greenhorn
Joined: Dec 24, 2011
Posts: 22
posted
0
Is it possible to display contents of a particular node using jsplitpane containing 2 jscrollpane, 1for tree and another to display node contents . when i click on node in the tree in scrollpane1, contents of only that particular node should be displayed in scrollpane2 not in the form of tree but in the form of normal folders.
> not in the form of tree but in the form of normal folders.
I'm reading this that you want to display a list of what's immediately under a selected parent,
similar to Windows Explorer clicking on a folder in the left pane, and the folder's contents
are displayed on the right, in list form (one under the other, whether another parent or leaf).
if so, use the tree's model --> getChildrenCount()/getChild() adding each child to a JList,
then add that to the RHS of the splitpane
You can use a JTable for the RHS and not necessarily a tree.
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Narendra kodli
Greenhorn
Joined: Dec 24, 2011
Posts: 22
posted
0
thanks for the reply
ok can use jtable, but i want some more information in getting node values. Mr.Michael Dunn you are right i want exactly the same results. can you elaborate it with some more details??
1) Add a TreeSelectionListener 2) In the listener, get the selected node.
3) Get the data from the selected node.
4) Now, update the rhs table model with data (based on the selected node).