wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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

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).
I agree. Here's the link: http://aspose.com/file-tools
subject: Event on selecing the same node in a JTree
Similar Threads
Setting selected node of a rich:tree dynamically
TreeSelectionListener interface valueChanged()
Cancelling events
Update JTree Node without firing ValueChanged
JTree Selection Customization