This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.



Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Event on selecing the same node in a JTree  RSS feed

 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!