コード例 #1
0
    /**
     * Returns the minimum dimensions this border requires in order to fully display the border and
     * title.
     *
     * @param c the component where this border will be drawn
     */
    public Dimension getMinimumSize(Component c) {
      Insets insets = getBorderInsets(c);
      Dimension minSize = new Dimension(insets.right + insets.left, insets.top + insets.bottom);
      minSize.width += label.getWidth();

      return minSize;
    }
コード例 #2
0
  public Dimension getMinimumSize() {
    if (getLayout() != null) {
      // A layout manager has been set, so delegate to it
      return super.getMinimumSize();
    }

    if (moreOrLessButton != null) {
      Dimension d = moreOrLessButton.getMinimumSize();
      Insets i = getInsets();
      d.width += i.left + i.right;
      d.height += i.top + i.bottom;
      return d;
    } else {
      return super.getMinimumSize();
    }
  }