This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm not sure how to work the TreePath thing with a TreeNode.
I see that I might be able to get it to work with getPathComponent(int index) but will the getSource() work as well? Just wondering.
What will getPathComponent() be returning, the data of the Tree, a String, or the TreeNode component? How do I know if this TreeNode is selected? I don't want it triggering the thing automatically without being selected.
Or do I use JTree's getLastSelectionPathComponent() or whatever it was called?
If you were to read the API for TreeSelectionListener, you would find a link to the tutorial on How to Write a Tree Selection Listener. At the top of that page is an example that details the course you need to follow.
There are no new questions, but there may be new answers.
Darryl Burke wrote:If you were to read the API for TreeSelectionListener, you would find a link to the tutorial on How to Write a Tree Selection Listener. At the top of that page is an example that details the course you need to follow.
Suppose I wanted to have more than one path visible at a time though?
sub sub node
sub sub 2 node
sub sub 3 node
And I wanted sub sub 2 node, when selected, to do something, but I wanted it possible to display all the tree paths and not block it so that only one can show at a time.