boolean (TreePath path, int mouseX, int mouseY) { JTree tree = getTree(); if (tree == null) return false; Rectangle bounds = getPathBounds(tree, path); if (bounds == null) return false; Control control = getControl(tree, path); bounds.x = getPainter(tree).getControlOffset(control, TreeUtil.getNodeDepth(tree, path), isLeaf(path.getLastPathComponent())); if (bounds.x < 0) return false; // does not paint an icon to expand or collapse path Insets insets = tree.getInsets(); bounds.x += insets.left; bounds.width = control.getWidth(); int height = 2 + control.getHeight(); if (height < bounds.height) { bounds.y += (bounds.height - height) / 2; bounds.height = height; } return bounds.contains(mouseX, mouseY); }