use of sun.swing.ImageIconUIResource in project jdk8u_jdk by JetBrains.
the class NimbusLookAndFeel method getDisabledIcon.
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
if (icon instanceof SynthIcon) {
SynthIcon si = (SynthIcon) icon;
BufferedImage img = EffectUtils.createCompatibleTranslucentImage(si.getIconWidth(), si.getIconHeight());
Graphics2D gfx = img.createGraphics();
si.paintIcon(component, gfx, 0, 0);
gfx.dispose();
return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
} else {
return super.getDisabledIcon(component, icon);
}
}
use of sun.swing.ImageIconUIResource in project jdk8u_jdk by JetBrains.
the class WindowsLookAndFeel method getDisabledIcon.
/**
* {@inheritDoc}
*
* @since 1.6
*/
public Icon getDisabledIcon(JComponent component, Icon icon) {
// in particular by the WindowsFileChooserUI class)
if (icon != null && component != null && Boolean.TRUE.equals(component.getClientProperty(HI_RES_DISABLED_ICON_CLIENT_KEY)) && icon.getIconWidth() > 0 && icon.getIconHeight() > 0) {
BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(component, img.getGraphics(), 0, 0);
ImageFilter filter = new RGBGrayFilter();
ImageProducer producer = new FilteredImageSource(img.getSource(), filter);
Image resultImage = component.createImage(producer);
return new ImageIconUIResource(resultImage);
}
return super.getDisabledIcon(component, icon);
}
Aggregations