Button and ToggleButton: do not paint background of disabled (and unselected) toolBar buttons (issue #292; regression since fixing #112)

This commit is contained in:
Karl Tauber
2021-03-31 22:28:43 +02:00
parent 6909bb4b03
commit 0a63990d21
2 changed files with 7 additions and 3 deletions

View File

@@ -8,6 +8,8 @@ FlatLaf Change Log
- Fixed crash when running in Webswing. (issue #290)
- Native window decorations: Removed superfluous pixel-line at top of screen
when window is maximized. (issue #296)
- Button and ToggleButton: Do not paint background of disabled (and unselected)
toolBar buttons. (issue #292; regression since fixing #112)
## 1.1.1

View File

@@ -388,10 +388,12 @@ public class FlatButtonUI
}
protected Color getBackground( JComponent c ) {
boolean toolBarButton = isToolBarButton( c );
// selected state
if( ((AbstractButton)c).isSelected() ) {
// in toolbar use same colors for disabled and enabled because
// we assume that toolbar icon is shown disabled
boolean toolBarButton = isToolBarButton( c );
return buttonStateColor( c,
toolBarButton ? toolbarSelectedBackground : selectedBackground,
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
@@ -400,10 +402,10 @@ public class FlatButtonUI
}
if( !c.isEnabled() )
return disabledBackground;
return toolBarButton ? null : disabledBackground;
// toolbar button
if( isToolBarButton( c ) ) {
if( toolBarButton ) {
ButtonModel model = ((AbstractButton)c).getModel();
if( model.isPressed() )
return toolbarPressedBackground;