mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
Button and ToggleButton: do not paint background of disabled (and unselected) toolBar buttons (issue #292; regression since fixing #112)
This commit is contained in:
@@ -8,6 +8,8 @@ FlatLaf Change Log
|
|||||||
- Fixed crash when running in Webswing. (issue #290)
|
- Fixed crash when running in Webswing. (issue #290)
|
||||||
- Native window decorations: Removed superfluous pixel-line at top of screen
|
- Native window decorations: Removed superfluous pixel-line at top of screen
|
||||||
when window is maximized. (issue #296)
|
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
|
## 1.1.1
|
||||||
|
|||||||
@@ -388,10 +388,12 @@ public class FlatButtonUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Color getBackground( JComponent c ) {
|
protected Color getBackground( JComponent c ) {
|
||||||
|
boolean toolBarButton = isToolBarButton( c );
|
||||||
|
|
||||||
|
// selected state
|
||||||
if( ((AbstractButton)c).isSelected() ) {
|
if( ((AbstractButton)c).isSelected() ) {
|
||||||
// in toolbar use same colors for disabled and enabled because
|
// in toolbar use same colors for disabled and enabled because
|
||||||
// we assume that toolbar icon is shown disabled
|
// we assume that toolbar icon is shown disabled
|
||||||
boolean toolBarButton = isToolBarButton( c );
|
|
||||||
return buttonStateColor( c,
|
return buttonStateColor( c,
|
||||||
toolBarButton ? toolbarSelectedBackground : selectedBackground,
|
toolBarButton ? toolbarSelectedBackground : selectedBackground,
|
||||||
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
|
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
|
||||||
@@ -400,10 +402,10 @@ public class FlatButtonUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !c.isEnabled() )
|
if( !c.isEnabled() )
|
||||||
return disabledBackground;
|
return toolBarButton ? null : disabledBackground;
|
||||||
|
|
||||||
// toolbar button
|
// toolbar button
|
||||||
if( isToolBarButton( c ) ) {
|
if( toolBarButton ) {
|
||||||
ButtonModel model = ((AbstractButton)c).getModel();
|
ButtonModel model = ((AbstractButton)c).getModel();
|
||||||
if( model.isPressed() )
|
if( model.isPressed() )
|
||||||
return toolbarPressedBackground;
|
return toolbarPressedBackground;
|
||||||
|
|||||||
Reference in New Issue
Block a user