mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27: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 ) {
|
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 ) {
|
protected Color getForeground( JComponent c ) {
|
||||||
|
if( !c.isEnabled() )
|
||||||
|
return disabledText;
|
||||||
|
|
||||||
boolean def = isDefaultButton( c );
|
boolean def = isDefaultButton( c );
|
||||||
return def ? defaultForeground : c.getForeground();
|
return def ? defaultForeground : c.getForeground();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,9 +206,7 @@ public class FlatToggleButtonUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Color getForeground( JComponent c ) {
|
protected Color getForeground( JComponent c ) {
|
||||||
ButtonModel model = ((AbstractButton)c).getModel();
|
if( c.isEnabled() && ((AbstractButton)c).isSelected() && !isToolBarButton( c ) )
|
||||||
|
|
||||||
if( model.isSelected() && !isToolBarButton( c ) )
|
|
||||||
return selectedForeground;
|
return selectedForeground;
|
||||||
|
|
||||||
return super.getForeground( c );
|
return super.getForeground( c );
|
||||||
|
|||||||
Reference in New Issue
Block a user