FlatSVGIcon: icons were not painted in disabled labels and disabled tabs (issue #205)

This commit is contained in:
Karl Tauber
2020-11-10 11:22:34 +01:00
parent 7c08489cb3
commit 847b41752c
5 changed files with 249 additions and 14 deletions

View File

@@ -170,6 +170,9 @@ public abstract class FlatLaf
@Override
public Icon getDisabledIcon( JComponent component, Icon icon ) {
if( icon instanceof DisabledIconProvider )
return ((DisabledIconProvider)icon).getDisabledIcon();
if( icon instanceof ImageIcon ) {
Object grayFilter = UIManager.get( "Component.grayFilter" );
ImageFilter filter = (grayFilter instanceof ImageFilter)
@@ -762,4 +765,24 @@ public abstract class FlatLaf
super( image );
}
}
//---- interface DisabledIconProvider -------------------------------------
/**
* A provider for disabled icons.
* <p>
* This is intended to be implemented by {@link javax.swing.Icon} implementations
* that provide the ability to paint disabled state.
* <p>
* Used in {@link FlatLaf#getDisabledIcon(JComponent, Icon)} to create a disabled icon from an enabled icon.
*/
public interface DisabledIconProvider
{
/**
* Returns an icon with a disabled appearance.
*
* @return a disabled icon
*/
Icon getDisabledIcon();
}
}