diff --git a/CHANGELOG.md b/CHANGELOG.md index e00dd4ec..ca0a9119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ FlatLaf Change Log - TabbedPane: New option to allow tab separators to take full height (to enable use `UIManager.put( "TabbedPane.tabSeparatorsFullHeight", true );`). (issue #59, PR #62) +- CheckBox and RadioButton: Do not fill background if `contentAreaFilled` is + `false`. (issue #58, PR #63) ## 0.26 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonUI.java index d248d685..f1c47ef6 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonUI.java @@ -118,11 +118,13 @@ public class FlatRadioButtonUI @Override public void paint( Graphics g, JComponent c ) { - // fill background even if opaque if - // - used as cell renderer (because of selection background) - // - if background was explicitly set to a non-UIResource color + // fill background even if not opaque if + // - contentAreaFilled is true and + // - used as cell renderer (because of selection background) + // - or if background was explicitly set to a non-UIResource color if( !c.isOpaque() && - (c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource)) ) + ((AbstractButton)c).isContentAreaFilled() && + (c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource))) { g.setColor( c.getBackground() ); g.fillRect( 0, 0, c.getWidth(), c.getHeight() );