merged PR #63 (for issue #58) into master (with modifications)

bug: AbstractButton's ContentAreaFilled=false not honored when parent is a CellRendererPane
This commit is contained in:
Karl Tauber
2020-02-11 18:34:44 +01:00
2 changed files with 8 additions and 4 deletions

View File

@@ -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

View File

@@ -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() );