List of utility methods to do Swing Icon
ImageIcon | getVerBumpIcon() get Ver Bump Icon return verBumpIcon;
|
ImageIcon | grayIcon(Icon icon) Make grascale using a ColorConvertOp if (icon == null || !(icon instanceof ImageIcon)) { return null; BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics g = image.createGraphics(); g.drawImage(((ImageIcon) icon).getImage(), 0, 0, null); g.dispose(); ... |
ImageIcon | iconFromStream(final InputStream in) icon From Stream if (in == null) { throw new IllegalArgumentException("Stream must not be null"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) > 0) { out.write(buffer, 0, read); ... |
JMenuItem | item(String name, Icon icon) item JMenuItem item = new JMenuItem(name); item.setIcon(icon); return item; |
ImageIcon | loadIcon(Class pRootClass, String strPath) load Icon URL imgURL = pRootClass.getResource(strPath); if (imgURL != null) return new ImageIcon(imgURL); else return null; |
ImageIcon | loadIcon(ClassLoader classLoader, String path) load Icon BufferedImage image = loadImage(classLoader, path); return (image != null) ? new ImageIcon(image) : null; |
ImageIcon | loadIcon(String icon) load Icon if (icon == null) { return null; try { return new ImageIcon(ImageIO.read(ClassLoader.getSystemResourceAsStream("icons/" + icon))); } catch (IOException e) { e.printStackTrace(); return null; ... |
Icon | loadIcon(String resourceName) Loads an icon from a resource. URL url = ClassLoader.getSystemResource(resourceName); return (url == null) ? null : new ImageIcon(url); |
Map | loadIcons(String list, String path, Set Loads a map of icons. try { InputStream in = loader.getResourceAsStream(list); if (in == null) return new HashMap<String, Icon>(); Properties properties = new Properties(); properties.load(in); in.close(); int index = list.lastIndexOf('/'); ... |
ImageIcon | loadLoadingIcon() load Loading Icon return new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("loading.gif")); |