Dimension (Dimension size, Dimension editorSize) { Insets i = comboBox.getInsets(); Icon icon = comboBox.isEditable() ? EDITABLE_ICON : ICON; int iconWidth = icon.getIconWidth() + i.right; int iconHeight = icon.getIconHeight() + i.top + i.bottom; int editorHeight = editorSize != null ? editorSize.height + i.top + i.bottom + padding.top + padding.bottom : 0; int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0; editorWidth = Math.max(editorWidth, DarculaUIUtil.MINIMUM_WIDTH.get() + i.left); int width = size != null ? size.width : 0; int height = size != null ? size.height : 0; width = Math.max(width + padding.left, editorWidth + iconWidth); height = Math.max(Math.max(iconHeight, height), editorHeight); return new Dimension(width, height); }