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); }
Rectangle parentBounds = getPathBounds(tree, parent); paintVerticalLine(g, tree, parentBounds.x + gap + 2, parentBounds.y + parentBounds.height / 2, bounds.y + bounds.height / 2);
  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);          }      }  }