Java Utililty Methods Swing Icon

List of utility methods to do Swing Icon

Description

The list of methods to do Swing Icon are organized into topic(s).

Method

ImageIcongetVerBumpIcon()
get Ver Bump Icon
return verBumpIcon;
ImageIcongrayIcon(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();
...
ImageIconiconFromStream(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);
...
JMenuItemitem(String name, Icon icon)
item
JMenuItem item = new JMenuItem(name);
item.setIcon(icon);
return item;
ImageIconloadIcon(Class pRootClass, String strPath)
load Icon
URL imgURL = pRootClass.getResource(strPath);
if (imgURL != null)
    return new ImageIcon(imgURL);
else
    return null;
ImageIconloadIcon(ClassLoader classLoader, String path)
load Icon
BufferedImage image = loadImage(classLoader, path);
return (image != null) ? new ImageIcon(image) : null;
ImageIconloadIcon(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;
...
IconloadIcon(String resourceName)
Loads an icon from a resource.
URL url = ClassLoader.getSystemResource(resourceName);
return (url == null) ? null : new ImageIcon(url);
MaploadIcons(String list, String path, Set ignore, ClassLoader loader)
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('/');
...
ImageIconloadLoadingIcon()
load Loading Icon
return new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("loading.gif"));