Object (@NotNull MouseEvent e) { final TreePath path = myTree.getPathForLocation(e.getX(), e.getY()); if (path == null) return null; final Rectangle rectangle = myTree.getPathBounds(path); if (rectangle == null) return null; int dx = e.getX() - rectangle.x; final Object treeNode = path.getLastPathComponent(); final int row = myTree.getRowForLocation(e.getX(), e.getY()); boolean isLeaf = myTree.getModel().isLeaf(treeNode); Component component = myTree.getCellRenderer().getTreeCellRendererComponent(myTree, treeNode, true, false, isLeaf, row, true); return component instanceof ColoredTreeCellRenderer ? ((ColoredTreeCellRenderer)component).getFragmentTagAt(dx) : null; }