Browse Source

Ensure state of renderer doesn't change before painting.

pull/222/head
weisj 4 years ago
parent
commit
779c7f64d3
  1. 6
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java

6
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java

@ -206,9 +206,10 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
@Override
public void paint(final Graphics g, final JComponent c) {
if (!comboBox.isEditable()) {
Rectangle rect = rectangleForCurrentValue();
Component currentValueRenderer = getRendererForCurrentValue();
paintBackground(g, c, currentValueRenderer);
paintCurrentValue(g, rectangleForCurrentValue(), hasFocus, currentValueRenderer);
paintCurrentValue(g, rect, hasFocus, currentValueRenderer);
} else {
paintBackground(g, c, getEditorComponent());
}
@ -366,9 +367,8 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
((JComponent) c).setOpaque(false);
}
boolean shouldValidate = c instanceof JPanel;
Rectangle r = new Rectangle(bounds);
currentValuePane.paintComponent(g, c, comboBox, r.x, r.y, r.width, r.height, shouldValidate);
currentValuePane.paintComponent(g, c, comboBox, r.x, r.y, r.width, r.height, c instanceof JPanel);
// return opaque for combobox popup items painting
if (changeOpaque) {
((JComponent) c).setOpaque(true);

Loading…
Cancel
Save