Forums Register Login

TreeExpansionListener

+Pie Number of slices to send: Send
Hello,
I have created an inner class that implements the TreeExpansionListener. I would like this class to select the node which invoked the expand or collapse event.
Example:
If I expand Folder1 to see the leafNodes, I would like Folder1 to be the selected node. If Folder1 contains Folder2 and I expand Folder2, Folder2 should be selected. And so on...
I don't know how to get the TreePath based on the node which invoked the expand or collapse event.
Any Ideas?
Thanks,
claude
+Pie Number of slices to send: Send
public void treeWillExpand(TreeExpansionEvent e) throws javax.swing.tree.ExpandVetoException {
TreePath path = e.getPath();
//The last component in the path is the exapanded node
}
+Pie Number of slices to send: Send
Thanks Swamy... Works Great!
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 590 times.
Similar Threads
Explaination is needed
creating a tree in JSP
JTree making a node act as parent
Expand and Collapse button: how to find the status of the button
Help with Jtree node handle icon .
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:40:26.