本文整理汇总了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);
}
示例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);
}
}
示例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));
}