diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java index 763d4cf21c0a..6fcf0a43effa 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java @@ -397,7 +397,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB Insets i = getInsets(); Dimension abSize = arrowButton.getPreferredSize(); - if (isCompact(comboBox)) { + if (isCompact(comboBox) && size != null) { JBInsets.removeFrom(size, padding); // don't count paddings in compact mode } @@ -405,8 +405,11 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0; editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left); - int width = Math.max(editorWidth + abSize.width, size.width + padding.left); - int height = Math.max(Math.max(editorHeight, Math.max(abSize.height, size.height)), + 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); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java index c707915d4b41..6724853e5136 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJComboBoxUI.java @@ -84,8 +84,13 @@ public class MacIntelliJComboBoxUI extends DarculaComboBoxUI { int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0; editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left); - return new Dimension(Math.max(size.width + padding.left, editorWidth + iconWidth), - Math.max(Math.max(iconHeight, size.height), editorHeight)); + 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); } @Override diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java index f9163e0ec6d2..faa9b3ff02c2 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java @@ -447,8 +447,13 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI { int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0; editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left); - return new Dimension(Math.max(editorWidth + ARROW_BUTTON_SIZE.width, size.width + padding.left), - Math.max(ARROW_BUTTON_SIZE.height, Math.max(editorHeight, size.height))); + int width = size != null ? size.width : 0; + int height = size != null ? size.height : 0; + + width = Math.max(editorWidth + ARROW_BUTTON_SIZE.width, width + padding.left); + height = Math.max(ARROW_BUTTON_SIZE.height, Math.max(editorHeight, height)); + + return new Dimension(width, height); } @Override