From a1d5f65588a85f72a8de8f201e8248e2d60fb2ec Mon Sep 17 00:00:00 2001 From: Bill Culp Date: Mon, 10 Feb 2020 23:37:27 -0800 Subject: [PATCH] bug: AbstractButton's ContentAreaFilled=false not honored when parent is a CellRendererPane docs: AbstractButton:setContentAreaFilled Sets the contentAreaFilled property. If true the button will paint the content area. If you wish to have a transparent button, such as an icon only button, for example, then you should set this to false. Do not call setOpaque(false). The default value for the the contentAreaFilled property is true. This function may cause the component's opaque property to change. The exact behavior of calling this function varies on a component-by-component and L&F-by-L&F basis. Parameters: b - if true, the content should be filled; if false the content area is not filled --- .../main/java/com/formdev/flatlaf/ui/FlatRadioButtonUI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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..ecfbb037 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 @@ -121,8 +121,9 @@ public class FlatRadioButtonUI // fill background even if opaque if // - used as cell renderer (because of selection background) // - if background was explicitly set to a non-UIResource color - if( !c.isOpaque() && - (c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource)) ) + if( ( !c.isOpaque() && + (c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource))) + || c instanceof AbstractButton && ((AbstractButton) c).isContentAreaFilled() ) { g.setColor( c.getBackground() ); g.fillRect( 0, 0, c.getWidth(), c.getHeight() );