Java Code Examples for sun.swing.ImageIconUIResource

The following examples show how to use sun.swing.ImageIconUIResource. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 2
Source Project: JDKSourceCode1.8   Source File: WindowsLookAndFeel.java    License: MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 3
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 4
Source Project: openjdk-8   Source File: WindowsLookAndFeel.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 5
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 6
Source Project: hottub   Source File: WindowsLookAndFeel.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 7
/**
 * {@inheritDoc}
 *
 * @since 1.6
 */
public Icon getDisabledIcon(JComponent component, Icon icon) {
    // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
    // client property set to Boolean.TRUE, then use the new
    // hi res algorithm for creating the disabled icon (used
    // 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);
}
 
Example 8
Source Project: material-ui-swing   Source File: MaterialImageFactory.java    License: MIT License 6 votes vote down vote up
public ImageIconUIResource getImage(String key) {
	if (key == null) {
		throw new IllegalArgumentException("Argument null");
	}
	String path = PATH_RESOUSES.trim() + key.trim() + ".png".trim();
	if (cacheImage.containsKey(path)) {
		return cacheImage.get(path);
	}
	try (InputStream inputStream = MaterialImageFactory.class.getResourceAsStream(path)) {
		BufferedImage image = ImageIO.read(inputStream);
		cacheImage.put(path, new ImageIconUIResource(image));
		return cacheImage.get(path);
	} catch (IOException e) {
		e.printStackTrace();
		throw new RuntimeException("Image " + path + " wasn't loaded");
	}
}
 
Example 9
Source Project: jdk1.8-source-analysis   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 10
@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);
    }
}
 
Example 11
Source Project: jdk8u60   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 12
Source Project: jdk8u60   Source File: MetalUtils.java    License: GNU General Public License v2.0 5 votes vote down vote up
static Icon getOceanDisabledButtonIcon(Image image) {
    Object[] range = (Object[])UIManager.get("Button.disabledGrayRange");
    int min = 180;
    int max = 215;
    if (range != null) {
        min = ((Integer)range[0]).intValue();
        max = ((Integer)range[1]).intValue();
    }
    ImageProducer prod = new FilteredImageSource(image.getSource(),
                  new OceanDisabledButtonImageFilter(min , max));
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 13
Source Project: JDKSourceCode1.8   Source File: MetalUtils.java    License: MIT License 5 votes vote down vote up
static Icon getOceanDisabledButtonIcon(Image image) {
    Object[] range = (Object[])UIManager.get("Button.disabledGrayRange");
    int min = 180;
    int max = 215;
    if (range != null) {
        min = ((Integer)range[0]).intValue();
        max = ((Integer)range[1]).intValue();
    }
    ImageProducer prod = new FilteredImageSource(image.getSource(),
                  new OceanDisabledButtonImageFilter(min , max));
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 14
@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);
    }
}
 
Example 15
static Icon getOceanDisabledButtonIcon(Image image) {
    Object[] range = (Object[])UIManager.get("Button.disabledGrayRange");
    int min = 180;
    int max = 215;
    if (range != null) {
        min = ((Integer)range[0]).intValue();
        max = ((Integer)range[1]).intValue();
    }
    ImageProducer prod = new FilteredImageSource(image.getSource(),
                  new OceanDisabledButtonImageFilter(min , max));
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 16
@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);
    }
}
 
Example 17
Source Project: jdk8u-jdk   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 18
Source Project: Java8CN   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 19
Source Project: Java8CN   Source File: MetalUtils.java    License: Apache License 2.0 5 votes vote down vote up
static Icon getOceanDisabledButtonIcon(Image image) {
    Object[] range = (Object[])UIManager.get("Button.disabledGrayRange");
    int min = 180;
    int max = 215;
    if (range != null) {
        min = ((Integer)range[0]).intValue();
        max = ((Integer)range[1]).intValue();
    }
    ImageProducer prod = new FilteredImageSource(image.getSource(),
                  new OceanDisabledButtonImageFilter(min , max));
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 20
Source Project: hottub   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 21
@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);
    }
}
 
Example 22
Source Project: jdk8u_jdk   Source File: MetalUtils.java    License: GNU General Public License v2.0 4 votes vote down vote up
static Icon getOceanToolBarIcon(Image i) {
    ImageProducer prod = new FilteredImageSource(i.getSource(),
                         new OceanToolBarImageFilter());
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 23
Source Project: jdk1.8-source-analysis   Source File: MetalUtils.java    License: Apache License 2.0 4 votes vote down vote up
static Icon getOceanToolBarIcon(Image i) {
    ImageProducer prod = new FilteredImageSource(i.getSource(),
                         new OceanToolBarImageFilter());
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 24
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public void setIconComputerFileChooser(ImageIconUIResource iconComputerFileChooser) {
    this.iconComputerFileChooser = iconComputerFileChooser;
}
 
Example 25
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public ImageIconUIResource getWarningIconOptionPane() {
    return warningIconOptionPane;
}
 
Example 26
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public void setInformationIconOptionPane(ImageIconUIResource informationIconOptionPane) {
    this.informationIconOptionPane = informationIconOptionPane;
}
 
Example 27
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public void setUnselectedCheckBoxIconSelectionRowTable(ImageIconUIResource unselectedCheckBoxIconSelectionRowTable) {
    this.unselectedCheckBoxIconSelectionRowTable = unselectedCheckBoxIconSelectionRowTable;
}
 
Example 28
Source Project: jdk8u60   Source File: MetalUtils.java    License: GNU General Public License v2.0 4 votes vote down vote up
static Icon getOceanToolBarIcon(Image i) {
    ImageProducer prod = new FilteredImageSource(i.getSource(),
                         new OceanToolBarImageFilter());
    return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}
 
Example 29
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public ImageIconUIResource getIconNewFolderFileChooser() {
    return iconNewFolderFileChooser;
}
 
Example 30
Source Project: material-ui-swing   Source File: AbstractMaterialTheme.java    License: MIT License 4 votes vote down vote up
public void setIconHomeFileChooser(ImageIconUIResource iconHomeFileChooser) {
    this.iconHomeFileChooser = iconHomeFileChooser;
}