Here you can find the source of getDisabledIcon(ImageIcon icon)
Parameter | Description |
---|---|
icon | The icon to disable |
public static final ImageIcon getDisabledIcon(ImageIcon icon)
//package com.java2s; // License: GPL. For details, see LICENSE file. import java.awt.Image; import java.awt.Toolkit; import java.awt.image.FilteredImageSource; import javax.swing.GrayFilter; import javax.swing.ImageIcon; public class Main { /**// ww w. ja v a2s . c om * Replies the disabled (grayed) version of the specified icon. * @param icon The icon to disable * @return The disabled (grayed) version of the specified icon, brightened by 20%. * @since 5484 */ public static final ImageIcon getDisabledIcon(ImageIcon icon) { return new ImageIcon(getDisabledImage(icon.getImage())); } /** * Replies the disabled (grayed) version of the specified image. * @param image The image to disable * @return The disabled (grayed) version of the specified image, brightened by 20%. * @since 5484 */ public static final Image getDisabledImage(Image image) { return Toolkit.getDefaultToolkit() .createImage(new FilteredImageSource(image.getSource(), new GrayFilter(true, 20))); } }