preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length));
maxHeight = 0; maxHeight = getMaxHeight(tree); preferredSize = new Dimension(maxWidth, (maxHeight * path.length));
  protected void updateCachedPreferredSize()  {    int maxWidth = 0;    boolean isLeaf = false;    if (currentVisiblePath != null)      {        Object[] path = currentVisiblePath.getPath();        for (int i = 0; i < path.length; i++)          {            TreePath curr = new TreePath(getPathToRoot(path[i], 0));            Rectangle bounds = getPathBounds(tree, curr);              if (treeModel != null)              isLeaf = treeModel.isLeaf(path[i]);            if (!isLeaf && hasControlIcons())              bounds.width += getCurrentControlIcon(curr).getIconWidth();            maxWidth = Math.max(maxWidth, bounds.x + bounds.width);          }        preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length));      }    else preferredSize = new Dimension(0, 0);    validCachedPreferredSize = true;  }