Upon selecting a node in my JTree, the UserObject is added to a vector. If a node is deselected, how can I find out what node it is? getLastSelectedPathComponent() returns null. Is there any other method I can use or event triggered when a node is deselected? I would really appreciate your help!! Thanks
Hi, Listen for treeSelection events. When the selction changes, you can get at at the old LeadSelection Path through the TreeSelectionEvent...
Which is the one just unselected. Let me know if this needs more explanation, Cheers, Kate
Joined: Jun 18, 2001
Thanks for your reply. I also got the path of the node selected by using the method of the TreeSelectionEvent class, isAddedPath. This returns false if the node was deselected. I now have a new problem... Hopefuly someone will know a solution. Say for example I have 2 nodes in my tree selected, and then I select another without pressing the ctrl key, therefore removing the others that were previously selected. Is there a method that will give me the nodes currently selected? thanks