Search in sources :

Example 1 with SynthIcon

use of sun.swing.plaf.synth.SynthIcon 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);
    }
}
Also used : ImageIconUIResource(sun.swing.ImageIconUIResource) BufferedImage(java.awt.image.BufferedImage) SynthIcon(sun.swing.plaf.synth.SynthIcon) Graphics2D(java.awt.Graphics2D)

Example 2 with SynthIcon

use of sun.swing.plaf.synth.SynthIcon in project intellij-community by JetBrains.

the class IconWrapper method paintIcon.

@Override
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
    SynthContext context = myOriginalUI.getContext((JComponent) c);
    ((SynthIcon) myIcon).paintIcon(context, g, x, y, getIconWidth(), getIconHeight());
}
Also used : SynthContext(javax.swing.plaf.synth.SynthContext) SynthIcon(sun.swing.plaf.synth.SynthIcon)

Aggregations

SynthIcon (sun.swing.plaf.synth.SynthIcon)2 Graphics2D (java.awt.Graphics2D)1 BufferedImage (java.awt.image.BufferedImage)1 SynthContext (javax.swing.plaf.synth.SynthContext)1 ImageIconUIResource (sun.swing.ImageIconUIResource)1