aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes DefaultTreeCellRenderer not highlighting TreeNode on right-click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "DefaultTreeCellRenderer not highlighting TreeNode on right-click" Watch "DefaultTreeCellRenderer not highlighting TreeNode on right-click" New topic
Author

DefaultTreeCellRenderer not highlighting TreeNode on right-click

Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
I'm using a renderer that extends DefaultTreeCellRenderer. When I left-click on a tree node, it becomes highlighted. But not on a right-click. At first I thought it was because the popupMenu was stealing the focus, but I took the menu code out and same results.

So, anyone know how to highlight a tree node when it's right-clicked?
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Turns out, all I needed was this code in my MouseAdapter inner class:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DefaultTreeCellRenderer not highlighting TreeNode on right-click