i have one tree root + one +subone - 1 // leaf node - 2 // leaf node +two +subtwo - 3 // leaf node - 4 // leaf node +three +subthree - 5 // leaf node - 6 // leaf node
My requirement is, i have to expand the parent of a leaf node in the tree.
Suppose if I pass object of �6�, the tree should expand �subthree� node.
i have tried in several ways to expand the tree 1) expandRow(int) -- expanding the immidiate childes of root only 2) expandPath(TreePath) -- I can't get path of a node. because mutable node have getPath() method, but it returns array of TreeNode not a TreePath.
Please help me.
Thanks in advance. Sasikala. [ April 19, 2005: Message edited by: sasi kala ]
Joined: Dec 17, 2004
thanks for the reply. i understand the way how tree works and done some coding to find the solution.
What i understand is "to expand a specific node in the tree, we need to expand all its parent nodes". My problem is, i have object of the node which has to be expanded in hand. and i don't know ancestors of that node.
what i observed in JTree is, 1) we have to store all nodes of a tree in some where (like Map), becasue to search any node the JTree needs only that node object (not even new node object with the same data).
2) row numbers of tree nodes are not static. When we pass a row number to "expandRow(row)" method, suppose n, the tree will expand nth visible node from the root.
i solve my problem like below
And finally i came out of the tree expanding problem. [ April 27, 2005: Message edited by: sasi kala ]