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

How to make a TreeNode response to a double mouse click?  RSS feed

 
Pier Klein
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a listener can be used for a double-click on a TreeNode?
Thanks!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Used for what?

There's a setToggleClickCount( int ) method that sets how many clicks it takes to make the tree nodes of a tree to expand.

If you need to do something else, you can just attach a MouseListener and get the number of clicks by calling getClickCount() on the MouseEvent. ( In fact, there is an example of this in the JavaDocs for JTree. )
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!