DefaultMutableTreeNode (Point point) { TreePath path = myTree.getPathForLocation(point.x, point.y); while (path != null) { final PackagingElement<?> element = myTree.getElementByPath(path); if (element instanceof CompositePackagingElement) { return (DefaultMutableTreeNode)path.getLastPathComponent(); } path = path.getParentPath(); } return null; }