Java Utililty Methods ImageIcon Load

List of utility methods to do ImageIcon Load

Description

The list of methods to do ImageIcon Load are organized into topic(s).

Method

ImageIcongetImageIcon(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;
ImageIcongetImageIcon(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;
...
ImageIcongetImageIcon(final String iconName)
get Image Icon
return new ImageIcon(getImage(iconName));
ImageIcongetImageIcon(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);
IcongetImageIcon(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;
ImageIcongetImageIcon(String filename)
get Image Icon
return new ImageIcon(ClassLoader.getSystemResource("resources/" + filename));
ImageIcongetImageIcon(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();
...
ImageIcongetImageIcon(String name)
Get an ImageIcon.
URL url = getURL(name);
if (url != null) {
    return new ImageIcon(url);
return null;
ImageIcongetImageIcon(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);
...
ImageIcongetImageIcon(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 {
...