List of utility methods to do Swing Icon
ImageIcon | getIcon(String _package, String iconName) Gets the icon in the specified package with the specified name. if (!_package.endsWith("/")) { _package += "/"; return getIcon(_package + iconName); |
Icon | getIcon(String f, Class> c) Get an Icon from the JAR file. Icon imageIcon = null; try { URL imageURL = c.getResource(f); if (imageURL == null) { return null; java.awt.image.ImageProducer I_P; I_P = (java.awt.image.ImageProducer) imageURL.getContent(); ... |
ImageIcon | getIcon(String name) get Icon URL urlImage = ClassLoader.getSystemResource("org/sunspotworld/heatsensors/icon/" + name + ".png"); ImageIcon img = new ImageIcon(urlImage); return new ImageIcon(img.getImage().getScaledInstance(16, 16, Image.SCALE_AREA_AVERAGING)); |
Icon | getIcon(String name) get Icon return new ImageIcon(name); |
Icon | getIcon(String name) get Icon try { return (Icon) Class.forName("com.projity.pm.graphic.IconManager") .getMethod("getIcon", new Class[] { String.class }).invoke(null, new Object[] { name }); } catch (Exception e) { return null; |
Icon | getIcon(String name) get Icon URL url = new File(name).toURI().toURL(); if (url != null) { return new ImageIcon(url); return null; |
Icon | getIcon(String name) Gets a resource as an Icon. Synchronous; may not suitable for large images. URL url = getURL(name); if (url != null) { return new ImageIcon(url); return null; |
ImageIcon | getIcon(String name, boolean isGrayIcon) gives an ImageIcon object given the name of it as it is witten in the SVGEditorIcons.properties file ImageIcon icon = null; if (name != null && !name.equals("")) { if (icons.containsKey(name)) { if (isGrayIcon) { icon = grayIcons.get(name); } else { icon = icons.get(name); } else { ResourceBundle iconsBundle = null; try { iconsBundle = ResourceBundle.getBundle("properties/SVGEditorIcons"); } catch (Exception ex) { String path = ""; if (iconsBundle != null) { try { path = iconsBundle.getString(name); } catch (Exception ex) { path = ""; if (path != null && !path.equals("")) { try { icon = new ImageIcon(new URL(getPath("icons/" + path))); } catch (Exception ex) { if (icon != null) { icons.put(name, icon); Image image = icon.getImage(); ImageIcon grayIcon = new ImageIcon(GrayFilter.createDisabledImage(image)); grayIcons.put(name, grayIcon); if (isGrayIcon) { icon = grayIcon; return icon; |
Icon | getIcon(String name, ClassLoader classLoader) get Icon BufferedInputStream iconIn; ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); int i; iconIn = new BufferedInputStream(classLoader.getResourceAsStream(name)); try { while ((i = iconIn.read()) > -1) { byteOut.write(i); return new ImageIcon(byteOut.toByteArray()); } catch (IOException e) { return null; |
JCheckBox | getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath, String selectedIconPath) get Icon Check Box JCheckBox checkBox = new JCheckBox(); checkBox.setIcon(new ImageIcon(iconPath)); checkBox.setPressedIcon(new ImageIcon(pressIconPath)); checkBox.setRolloverIcon(new ImageIcon(rolloverIconPath)); checkBox.setSelectedIcon(new ImageIcon(selectedIconPath)); checkBox.setBorder(null); checkBox.setFocusPainted(false); checkBox.setContentAreaFilled(false); ... |