Dimension (Dimension size, Dimension editorSize) { Insets i = getInsets(); Dimension abSize = getArrowButtonPreferredSize(comboBox); if (isCompact(comboBox) && size != null) { JBInsets.removeFrom(size, padding); // don't count paddings in compact mode } int editorHeight = editorSize != null ? editorSize.height + i.top + i.bottom : 0; int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0; editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left); int width = size != null ? size.width : 0; int height = size != null ? size.height : 0; width = Math.max(editorWidth + abSize.width, width + padding.left); height = Math.max(Math.max(editorHeight, Math.max(abSize.height, height)), (isCompact(comboBox) ? COMPACT_HEIGHT.get() : MINIMUM_HEIGHT.get()) + i.top + i.bottom); return new Dimension(width, height); }