Button and ToggleButton: paint disabled background by default (issue #112)

This commit is contained in:
Karl Tauber
2020-06-18 11:10:59 +02:00
parent fe15f44e96
commit 5c7378cf94
4 changed files with 13 additions and 2 deletions

View File

@@ -284,6 +284,7 @@ public abstract class FlatLaf
// initialize some defaults (for overriding) that are used in UI delegates,
// but are not set in BasicLookAndFeel
putDefaults( defaults, defaults.getColor( "control" ),
"Button.disabledBackground",
"EditorPane.disabledBackground",
"EditorPane.inactiveBackground",
"FormattedTextField.disabledBackground",
@@ -293,7 +294,8 @@ public abstract class FlatLaf
"TextArea.inactiveBackground",
"TextField.disabledBackground",
"TextPane.disabledBackground",
"TextPane.inactiveBackground" );
"TextPane.inactiveBackground",
"ToggleButton.disabledBackground" );
putDefaults( defaults, defaults.getColor( "textInactiveText" ),
"Button.disabledText",
"CheckBox.disabledText",

View File

@@ -147,6 +147,11 @@ public class IntelliJTheme
applyColorPalette( defaults );
applyCheckBoxColors( defaults );
// IDEA does not paint button background if disabled, but FlatLaf does
Object panelBackground = defaults.get( "Panel.background" );
defaults.put( "Button.disabledBackground", panelBackground );
defaults.put( "ToggleButton.disabledBackground", panelBackground );
// IDEA uses a SVG icon for the help button, but paints the background with Button.startBackground and Button.endBackground
Object helpButtonBackground = defaults.get( "Button.startBackground" );
Object helpButtonBorderColor = defaults.get( "Button.startBorderColor" );
@@ -156,7 +161,7 @@ public class IntelliJTheme
helpButtonBorderColor = defaults.get( "Button.borderColor" );
defaults.put( "HelpButton.background", helpButtonBackground );
defaults.put( "HelpButton.borderColor", helpButtonBorderColor );
defaults.put( "HelpButton.disabledBackground", defaults.get( "Panel.background" ) );
defaults.put( "HelpButton.disabledBackground", panelBackground );
defaults.put( "HelpButton.disabledBorderColor", defaults.get( "Button.disabledBorderColor" ) );
defaults.put( "HelpButton.focusedBorderColor", defaults.get( "Button.focusedBorderColor" ) );
defaults.put( "HelpButton.focusedBackground", defaults.get( "Button.focusedBackground" ) );