List of utility methods to do ImageIcon Load
ImageIcon | getImageIcon(Class> _class, String resourceName) Used to get instance of ImageIcon object. Image image = getImage(_class, resourceName); if (image != null) { return new ImageIcon(image); } else { return null; |
ImageIcon | getImageIcon(final Class baseClass, final String image) Create an Icon from a given resource. if (image == null) { return null; final byte[][] buffer = new byte[1][]; try { InputStream resource = baseClass.getResourceAsStream(image); if (resource == null) { return null; ... |
ImageIcon | getImageIcon(final String iconName) get Image Icon return new ImageIcon(getImage(iconName)); |
ImageIcon | getImageIcon(final String location) Get an image as a resource and create an ImageIcon ImageIcon icon = null; URL url = Thread.currentThread().getContextClassLoader().getResource(location); if (url != null) icon = new ImageIcon(url); return (icon); |
Icon | getImageIcon(Image imp, int width, int height) get Image Icon Image image = imp.getScaledInstance(width, height, Image.SCALE_SMOOTH); Icon icon = new ImageIcon(image); return icon; |
ImageIcon | getImageIcon(String filename) get Image Icon return new ImageIcon(ClassLoader.getSystemResource("resources/" + filename)); |
ImageIcon | getImageIcon(String filename, String description) Keeps a hashmap of SoftReferences to images, hashed by filename, so that the same image icon will be used for multiple versions of the same image. ResourceBundle bundle = ResourceBundle.getBundle("com.stottlerhenke.simbionic.editor.gui.ImageBundle"); try { ImageIcon icon = (ImageIcon) bundle.getObject(filename); if (icon == null) return new ImageIcon(); return icon; } catch (Exception e) { return new ImageIcon(); ... |
ImageIcon | getImageIcon(String name) Get an ImageIcon. URL url = getURL(name); if (url != null) { return new ImageIcon(url); return null; |
ImageIcon | getImageIcon(String name) Charge une image Toolkit toolkit = Toolkit.getDefaultToolkit(); URL url; url = ClassLoader.getSystemResource("org/analyse/core/gui/images/" + name); if (url == null) { url = ClassLoader.getSystemResource("org/analyse/core/gui/images/home.png"); ImageIcon icon = new ImageIcon(url); hashtable.put(name, icon); ... |
ImageIcon | getImageIcon(String path) getImageIcon. try { Object o = new Object(); Class c = o.getClass(); URL url = c.getResource("/" + path); return new ImageIcon(url); } catch (Exception e) { try { ... |