Dimension (JComponent c, Dimension prefSize) { Insets i = c.getInsets(); prefSize = ObjectUtils.notNull(prefSize, JBUI.emptySize()); if (UIUtil.isHelpButton(c) || isSquare(c)) { int helpDiam = HELP_BUTTON_DIAMETER.get(); return new Dimension(Math.max(prefSize.width, helpDiam + i.left + i.right), Math.max(prefSize.height, helpDiam + i.top + i.bottom)); } else { int width = isComboAction(c) ? prefSize.width : Math.max(HORIZONTAL_PADDING.get() * 2 + prefSize.width, MINIMUM_BUTTON_WIDTH.get() + i.left + i.right); int height = Math.max(prefSize.height, (isSmallVariant(c) ? ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE.height : getMinimumHeight()) + i.top + i.bottom); return new Dimension(width, height); } }