int max = tree.getVisibleRowCount(); for (int i = 0; i < max; i++) { Object curr = path.getPathComponent(i); TreePath currPath = new TreePath(getPathToRoot(curr, 0)); int numChild = treeModel.getChildCount(curr); if (numChild > 0 && tree.isExpanded(currPath))
Rectangle bounds = getPathBounds(tree, path); TreePath parent = path.getParentPath(); if (parent != null)
  protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,                                        Insets insets, TreePath path)  {    int max = tree.getVisibleRowCount();    for (int i = 0; i < max; i++)      {        Object curr = path.getPathComponent(i);        TreePath currPath = new TreePath(getPathToRoot(curr, 0));        int numChild = treeModel.getChildCount(curr);        if (numChild > 0 && tree.isExpanded(currPath))          {            Rectangle bounds = getPathBounds(tree, currPath);            Rectangle lastChildBounds = getPathBounds(                                                      tree,                                                      new TreePath(                                                                   getPathToRoot(                                                                                 treeModel.getChild(                                                                                                    curr,                                                                                                    numChild - 1),                                        0)));            paintVerticalLine(g, tree, bounds.x + gap + 2, bounds.y                                                           + bounds.height - 2,                              lastChildBounds.y + lastChildBounds.height / 2);          }      }  }