sun.swing.ImageIconUIResource Java Examples

The following examples show how to use sun.swing.ImageIconUIResource. 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
Source File: WindowsLookAndFeel.java    From hottub with 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 #2
Source File: WindowsLookAndFeel.java    From JDKSourceCode1.8 with 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
Source File: WindowsLookAndFeel.java    From openjdk-jdk9 with 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 #4
Source File: WindowsLookAndFeel.java    From dragonwell8_jdk with 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
Source File: WindowsLookAndFeel.java    From openjdk-8 with 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 #6
Source File: WindowsLookAndFeel.java    From openjdk-jdk8u with 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
Source File: WindowsLookAndFeel.java    From openjdk-8-source with 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 #8
Source File: MaterialImageFactory.java    From material-ui-swing with 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 File: MetalUtils.java    From Java8CN with 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 #10
Source File: MetalUtils.java    From jdk8u60 with 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 #11
Source File: NimbusLookAndFeel.java    From jdk8u60 with 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 File: NimbusLookAndFeel.java    From hottub with 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 #13
Source File: NimbusLookAndFeel.java    From openjdk-8-source with 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 #14
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u with 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 #15
Source File: NimbusLookAndFeel.java    From TencentKona-8 with 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 #16
Source File: NimbusLookAndFeel.java    From Java8CN with 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 #17
Source File: NimbusLookAndFeel.java    From jdk8u-jdk with 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 File: MetalUtils.java    From JDKSourceCode1.8 with 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 #19
Source File: NimbusLookAndFeel.java    From openjdk-jdk9 with 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 #20
Source File: MetalUtils.java    From openjdk-jdk8u-backup with 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 #21
Source File: NimbusLookAndFeel.java    From jdk1.8-source-analysis with 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 #22
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getUnselectedIconToggleButton() {
    return unselectedIconToggleButton;
}
 
Example #23
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getIconDirectoryFileChooser() {
    return iconDirectoryFileChooser;
}
 
Example #24
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getUnselectedCheckBoxIconSelectionRowTable() {
    return unselectedCheckBoxIconSelectionRowTable;
}
 
Example #25
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getUnselectedRadioButtonIcon() {
    return unselectedRadioButtonIcon;
}
 
Example #26
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getNoCollapsedTaskPane() {
    return noCollapsedTaskPane;
}
 
Example #27
Source File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public ImageIconUIResource getOpenIconTree() {
    return openIconTree;
}
 
Example #28
Source File: MetalUtils.java    From jdk8u-jdk with 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 File: AbstractMaterialTheme.java    From material-ui-swing with MIT License 4 votes vote down vote up
public void setIconFloppyDriveFileChooser(ImageIconUIResource iconFloppyDriveFileChooser) {
    this.iconFloppyDriveFileChooser = iconFloppyDriveFileChooser;
}
 
Example #30
Source File: MetalUtils.java    From Bytecoder with 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));
}