ComboBox: fixed painting background outside of border if Component.arc is set to a large value

This commit is contained in:
Karl Tauber
2020-05-12 19:24:29 +02:00
parent 659ead903c
commit 71e698603d
2 changed files with 5 additions and 3 deletions

View File

@@ -5,6 +5,9 @@ FlatLaf Change Log
- Added drop shadows to popup menus, combobox popups, tooltips and internal
frames. (issue #94)
- Paint nicely rounded buttons, comboboxes, spinners and text fields when
setting `Button.arc`, `Component.arc` or `TextComponent.arc` to a large value
(e.g. 1000).
- Added Java 9 module descriptor to `flatlaf-extras-<version>.jar` and
`flatlaf-swingx-<version>.jar`.

View File

@@ -319,7 +319,7 @@ public class FlatComboBoxUI
@Override
public void update( Graphics g, JComponent c ) {
// fill background if opaque to avoid garbage if user sets opaque to true
if( c.isOpaque() && (focusWidth > 0 || arc != 0) )
if( c.isOpaque() && (focusWidth > 0 || arc > 0) )
FlatUIUtils.paintParentBackground( g, c );
Graphics2D g2 = (Graphics2D) g;
@@ -394,8 +394,7 @@ public class FlatComboBoxUI
@Override
public void paintCurrentValueBackground( Graphics g, Rectangle bounds, boolean hasFocus ) {
g.setColor( comboBox.isEnabled() ? comboBox.getBackground() : getDisabledBackground( comboBox ) );
g.fillRect( bounds.x, bounds.y, bounds.width, bounds.height );
// not necessary because already painted in update()
}
private Color getDisabledBackground( JComponent c ) {