This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Event on selecing the same node in a JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Event on selecing the same node in a JTree" Watch "Event on selecing the same node in a JTree" New topic
Author

Event on selecing the same node in a JTree

Ashish Chopra
Ranch Hand

Joined: Nov 30, 2004
Posts: 134
I need to handle a scenario in my code where the trigger is the selection of an already selected tree node. Now I have a TreeListener attached to the tree, but it only generates an event in case I select a node different from the one already selected.

Is there any other type of listener that I can attach with my tree that will allow me to catch the re-selection of an already selected node?


Quis Custodiet Ipsos Custodes<br /> <br />My blog: <a href="http://www.coherentrambling.blogspot.com" target="_blank" rel="nofollow">http://www.coherentrambling.blogspot.com</a>
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You could add a MouseListener to listen for mouse selections. The JTree api has methods for
finding the row and path for any given view location and for finding the current selection(s).
 
Consider Paul's rocket mass heater.
 
subject: Event on selecing the same node in a JTree