aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JPopupMenu inside a Jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPopupMenu inside a Jtree" Watch "JPopupMenu inside a Jtree" New topic
Author

JPopupMenu inside a Jtree

Chris Heady
Greenhorn

Joined: Jun 28, 2001
Posts: 9
I was trying to put a popupMenu into a JTree, and I thought I had followed what most examples show, but my popupMenu never appears when I right click on the JTree. Also the isPopupTrigger is never true even when I use the other method (e.isPopupTrigger()). I have tried to add the popupMenu to the JTree as I have sometimes seen in examples but that did nothing. I also put the JTree into a scrollPane later on, would that affect anything? The pertinent code is below. Thanks for any help.

[ February 07, 2002: Message edited by: Chris Heady ]
[ February 07, 2002: Message edited by: Chris Heady ]
Chris Heady
Greenhorn

Joined: Jun 28, 2001
Posts: 9
I actually found how to fix this. My main program had originally extended Applet, I decided to change to JApplet since most of my stuff was swing, and my popup just suddenly started working. I wonder why the Applet was letting me use swing components in the first place, most of the swing components worked, except for the popupMenu. Anyone know why this behavior exists?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPopupMenu inside a Jtree