Java Swing Icon getIcon(String name)

Here you can find the source of getIcon(String name)

Description

get Icon

License

Open Source License

Declaration

public static ImageIcon getIcon(String name) 

Method Source Code


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

import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;

public class Main {
    public static ImageIcon getIcon(String name) {
        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));
    }// w  w w .  ja  va  2 s  .c  o  m
}

Related

  1. getIcon(String f, Class c)
  2. getIcon(String name)
  3. getIcon(String name)
  4. getIcon(String name)
  5. getIcon(String name)
  6. getIcon(String name, boolean isGrayIcon)
  7. getIcon(String name, ClassLoader classLoader)
  8. getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath, String selectedIconPath)
  9. getIconFromExtension(String f, boolean folder)