Here you can find the source of getIcon(String name)
public static ImageIcon getIcon(String name)
//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 }