mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
Button: invoke FlatButtonUI.getForeground(c) also if component is disabled to be consistent with getBackground(c)
This commit is contained in:
@@ -350,7 +350,7 @@ public class FlatButtonUI
|
||||
}
|
||||
}
|
||||
|
||||
paintText( g, b, textRect, text, b.isEnabled() ? getForeground( b ) : disabledText );
|
||||
paintText( g, b, textRect, text, getForeground( b ) );
|
||||
}
|
||||
|
||||
public static void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text, Color foreground ) {
|
||||
@@ -408,6 +408,9 @@ public class FlatButtonUI
|
||||
}
|
||||
|
||||
protected Color getForeground( JComponent c ) {
|
||||
if( !c.isEnabled() )
|
||||
return disabledText;
|
||||
|
||||
boolean def = isDefaultButton( c );
|
||||
return def ? defaultForeground : c.getForeground();
|
||||
}
|
||||
|
||||
@@ -206,9 +206,7 @@ public class FlatToggleButtonUI
|
||||
|
||||
@Override
|
||||
protected Color getForeground( JComponent c ) {
|
||||
ButtonModel model = ((AbstractButton)c).getModel();
|
||||
|
||||
if( model.isSelected() && !isToolBarButton( c ) )
|
||||
if( c.isEnabled() && ((AbstractButton)c).isSelected() && !isToolBarButton( c ) )
|
||||
return selectedForeground;
|
||||
|
||||
return super.getForeground( c );
|
||||
|
||||
Reference in New Issue
Block a user