private void calculateAutoPopupRect() {
    int firstHidden = -1;
    int edge = 0;
    for (int i = 0; i < myComponentBounds.size(); i++) {
      Rectangle r = myComponentBounds.get(i);
      if (r.x == Integer.MAX_VALUE || r.y == Integer.MAX_VALUE) {
        firstHidden = i;
        break;
      }
      edge = (int)(myOrientation == SwingConstants.HORIZONTAL ? r.getMaxX() : r.getMaxY());
    }

    if (firstHidden >= 0) {
      Dimension size = getSize();
      Insets insets = getInsets();
      myFirstOutsideIndex = firstHidden;
      myAutoPopupRec = myOrientation == SwingConstants.HORIZONTAL
                       ? new Rectangle(edge, insets.top, size.width - edge - insets.right, size.height - insets.top - insets.bottom)
                       : new Rectangle(insets.left, edge, size.width - insets.left - insets.right, size.height - edge - insets.bottom);
    }
    else {
      myAutoPopupRec = null;
      myFirstOutsideIndex = -1;
    }
  }
private void calculateAutoPopupRect()