List of utility methods to do Swing Icon
Icon | createColourIcon(int colour) create Colour Icon BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < 16; x++) { for (int y = 0; y < 16; y++) { image.setRGB(x, y, colour); return new ImageIcon(image); |
Icon | createGrayIcon(Icon icon) create Gray Icon return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) icon).getImage())); |
Icon | createGrayIcon(Icon icon) Creates a 'disabled' version of an icon. Icon disabledIcon = null; if (icon instanceof ImageIcon) disabledIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) icon).getImage())); return (disabledIcon != null) ? disabledIcon : icon; |
javax.swing.Icon | createIcon(java.awt.Component component) create Icon javax.swing.Icon rv; java.awt.Dimension size = component.getPreferredSize(); if ((size.width > 0) && (size.height > 0)) { java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(size.width, size.height, java.awt.image.BufferedImage.TYPE_INT_ARGB); java.awt.Graphics g = image.getGraphics(); if (IS_PRINT_USED) { component.print(g); ... |
Icon | createIcon(String resource) create Icon URL url = ClassLoader.getSystemResource(resource); return new ImageIcon(url); |
ImageIcon | createIcon(URL resource) This method creates and returns an icon. return new ImageIcon(resource); |
ImageIcon | createIconFromResource(ClassLoader loader, String resourceName) create Icon From Resource return createIconFromResource(loader, resourceName, ""); |
ImageIcon | createIconFromStream(InputStream input) create Icon From Stream return createIconFromStream(input, ""); |
Icon | createTransparentIcon() create Transparent Icon BufferedImage emptyImage = new BufferedImage(SMALL_ICON_WIDTH, SMALL_ICON_WIDTH, BufferedImage.TYPE_INT_ARGB); return new ImageIcon(emptyImage); |
Icon | createTransparentIcon(final int width, final int height) Creates a transparent icon. return new ImageIcon(createTransparentImage(width, height)); |