Java Swing Icon buildIcon(final String relativePath, final Class loader)

Here you can find the source of buildIcon(final String relativePath, final Class loader)

Description

build Icon

License

Open Source License

Declaration

public static Icon buildIcon(final String relativePath, final Class loader) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

import java.net.URL;

public class Main {
    public static Icon buildIcon(final String relativePath, final Class loader) {
        URL resource = loader.getResource(relativePath);
        if (resource != null) {
            return new ImageIcon(resource);
        } else {/*w  w  w .  ja  v  a 2  s.  co  m*/
            System.err.println("[ImageHelper] Invalid resource: " + relativePath + " Loader: " + loader.getName());
            throw new IllegalArgumentException("Invalid resource");
        }
    }
}

Related

  1. areSizesEqual(javax.swing.Icon prevIcon, javax.swing.Icon nextIcon)
  2. blendIcon(Icon icon, float iconWeight, int rgb, float rgbWeight)
  3. blitBitmap(Graphics g, Icon icon, int x, int y, int w, int h)
  4. changeBrightness(Icon icon, float factor)
  5. clearMergedIconsCache()
  6. combineIcons(Icon underIcon, Icon overIcon)
  7. concatenateIcons(final Icon icon1, final Icon icon2)