@SuppressWarnings("unchecked")
  @Override
  public void paintFigure(Graphics g) {
    super.paintFigure(g);
    Rectangle r = getBounds();
    Rectangle rc = getContentPane(1).getBounds();
    List<IFigure> children = ((IFigure) getContentPane(1).getChildren().get(0)).getChildren();

    if (children.size() > 0) {
      int xm = rc.x + rc.width / 2;
      int y0 = rc.y - 6;
      int y1 = y0;

      if (getContentPane(1).isVisible()) {
        g.drawLine(xm, r.y, xm, y0);

        y1 = rc.y + rc.height - 1 + 5;

        if (children.size() >= 2) {
          Rectangle r0 = children.get(0).getBounds();
          Rectangle r1 = children.get(children.size() - 1).getBounds();
          int x0 = r0.x + r0.width / 2;
          int x1 = r1.x + r1.width / 2;

          g.drawLine(x0, y0, x1, y0);
          g.drawLine(x0, y1, x1, y1);
        }

        for (int i = 0; i < children.size(); i++) {
          Rectangle ri = children.get(i).getBounds();
          int xi = ri.x + ri.width / 2;
          int yi = ri.y + ri.height;

          g.drawLine(xi, y0, xi, ri.y);
          g.drawLine(xi, yi, xi, y1);
        }

        g.drawLine(xm, y1, xm, r.y + r.height - 1);
      }
    }
  }
 @Override
 protected void paintClientArea(Graphics graphics) {
   super.paintClientArea(graphics);
   paintConnections(graphics);
   graphics.restoreState();
 }
 @Override
 protected void paintFigure(Graphics graphics) {
   super.paintBorder(graphics);
   super.paintFigure(graphics);
 }