• Post Reply Bookmark Topic Watch Topic
  • New Topic

TreeExpansionListener  RSS feed

 
claude jones
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Swamy Vatti
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public void treeWillExpand(TreeExpansionEvent e) throws javax.swing.tree.ExpandVetoException {
TreePath path = e.getPath();
//The last component in the path is the exapanded node
}
 
claude jones
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Swamy... Works Great!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!