当前位置: 首页>>代码示例>>Java>>正文


Java ImageIconUIResource类代码示例

本文整理汇总了Java中sun.swing.ImageIconUIResource的典型用法代码示例。如果您正苦于以下问题:Java ImageIconUIResource类的具体用法?Java ImageIconUIResource怎么用?Java ImageIconUIResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageIconUIResource类属于sun.swing包,在下文中一共展示了ImageIconUIResource类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDisabledIcon

import sun.swing.ImageIconUIResource; //导入依赖的package包/类
/**
 * {@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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:WindowsLookAndFeel.java

示例2: getDisabledIcon

import sun.swing.ImageIconUIResource; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:NimbusLookAndFeel.java

示例3: getOceanDisabledButtonIcon

import sun.swing.ImageIconUIResource; //导入依赖的package包/类
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));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:MetalUtils.java


注:本文中的sun.swing.ImageIconUIResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。