/** * This default implementation returns a new <code>Insets</code> * instance where the <code>top</code>, <code>left</code>, * <code>bottom</code>, and * <code>right</code> fields are set to <code>0</code>. * @param c the component for which this border insets value applies * @return the new <code>Insets</code> object initialized to 0 */ @Override public Insets getBorderInsets(Component c) { return getBorderInsets(c, new Insets(0, 0, 0, 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); String title = getTitle(); if ((title != null) && !title.isEmpty()) { JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); int position = getPosition(); if ((position != ABOVE_TOP) && (position != BELOW_BOTTOM)) { minSize.width += size.width; } else if (minSize.width < size.width) { minSize.width += size.width; } } return minSize; }