This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes  how to implement -- click right botton to select a JTree's node? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " how to implement -- click right botton to select a JTree Watch " how to implement -- click right botton to select a JTree New topic
Author

how to implement -- click right botton to select a JTree's node?

Kenny Smith
Greenhorn

Joined: Jan 08, 2002
Posts: 9
In the default case, you can select a node by click the left botton.
But how to implement -- click right botton to select a JTree's node?
Thanks.


Kenny Smith
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6


The only other check I do after that is
if (selectedNode.isLeaf()) because I implement a JPopup Menu but only on a Leaf.
Hope that helps.
BTW - Forgot to mention that I do this in the mouseClicked(MouseEvent me) method of my mouse listener I have registered on my JTree.
[ February 12, 2003: Message edited by: Gregg Bolinger ]

GenRocket - A Test Data Generation Platform
Kenny Smith
Greenhorn

Joined: Jan 08, 2002
Posts: 9
It works, thanks and regards!
ramswaroop ram
Greenhorn

Joined: Oct 25, 2011
Posts: 8
Thanks Gregg Bolinger.. It really healped me..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to implement -- click right botton to select a JTree's node?
 
Similar Threads
StarUML - Adding tagged values in deployment diagram
Help me ,immediately !!!!
NX: mnemonics problem in windows XP
JTree row selection by mouseclick question
[JTree]Block event?