Fix the combo arrow paint on JBUI.scale change

- Use JBDimention.update() to stick to JBUI.scale
- Repeat 'bw' dancing for the arrow painting
This commit is contained in:
Anton Tarasov
2017-09-15 17:19:18 +03:00
parent d5617bcacb
commit 001ef93ae2
@@ -52,7 +52,7 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
private static final String HOVER_PROPERTY = "JComboBox.mouseHover";
private static final String PRESSED_PROPERTY = "JComboBox.mousePressed";
private static final Border DEFAULT_EDITOR_BORDER = JBUI.Borders.empty(1, 0);
private static final Dimension ARROW_BUTTON_SIZE = new JBDimension(21, 24); // Count borders
private static final JBDimension ARROW_BUTTON_SIZE = new JBDimension(21, 24); // Count borders
private MouseListener mouseListener;
@@ -225,6 +225,9 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
Rectangle innerRect = new Rectangle(getSize());
JBInsets.removeFrom(innerRect, getInsets());
int bw = comboBox.getClientProperty("JComponent.error.outline") == Boolean.TRUE ? 2 : 1; // see paintBorder()
JBInsets.removeFrom(innerRect, JBUI.insets(bw));
// paint background
if (comboBox.isEditable() && comboBox.isEnabled()) {
if (isPressed() || popup.isVisible()) {
@@ -508,6 +511,7 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
}
private Dimension getSizeWithButton(Dimension d) {
ARROW_BUTTON_SIZE.update();
Insets i = comboBox.getInsets();
int width = ARROW_BUTTON_SIZE.width + i.left;
return new Dimension(Math.max(d.width + JBUI.scale(10), width),