I\'m trying to use the JTree and implement different drop downs for all the parent nodes and the children nodes.
Here\'s what I\'ve done:
pmTree.addM
Awesome. I was successfully able to put the setSelectionPath()
call inside the override of getPopupLocaiton()
. I had been trying to do it inside the ActionListener
of my JMenuItem
to no avail.
public Point getPopupLocation( MouseEvent e ) {
Point point = null;
if( e != null ) {
TreePath path = getClosestPathForLocation( e.getX(), e.getY() );
setSelectionPath( path );
point = e.getPoint();
}
return point;
}