if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0))))
if (tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
   int paintControlIcons(Graphics g, int indentation, int descent,         int childNumber, int depth, JTree tree, TreeModel mod, Object node)   {      int h = descent;      int rowHeight = getRowHeight();      Icon ei = UIManager.getLookAndFeelDefaults()         .getIcon("Tree.expandedIcon");      Icon ci = UIManager.getLookAndFeelDefaults()         .getIcon("Tree.collapsedIcon");      Rectangle clip = g.getClipBounds();      if (indentation > clip.x + clip.width + rightChildIndent            || descent > clip.y + clip.height + getRowHeight())         return descent;            if (mod.isLeaf(node))         descent += rowHeight;      else       {         if (depth > 0 || tree.isRootVisible())            descent += rowHeight;                  int max = mod.getChildCount(node);        if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0))))         {            if (!node.equals(mod.getRoot()))              drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h);                        for (int i = 0; i < max; ++i)            {               int indent = indentation + rightChildIndent;               if (depth == 0 && !tree.isRootVisible())                  indent = -1;                              descent = paintControlIcons(g, indent,                                            descent, i, depth + 1, tree, mod,                                             mod.getChild(node, i));            }         }         else if (!node.equals(mod.getRoot()))          drawCentered(tree, g, ei, indentation - rightChildIndent - 3,                   descent - getRowHeight());      }          return descent;  }