static void treePopupMenu(final JTree tree, final VF2 fillMenu) { componentPopupMenu2(tree, voidfunc(JTree tree, JPopupMenu menu) { MouseEvent evt = componentPopupMenu_getEvent(); TreePath path = tree.getPathForLocation(evt.getX(), evt.getY()); if (path == null) ret; DefaultMutableTreeNode node = cast path.getLastPathComponent(); tree.setSelectionPath(path); A a = cast node.getUserObject(); callF(fillMenu, menu, a); }); }