Here you can find the source of getImageIcon(String name)
public static ImageIcon getImageIcon(String name)
//package com.java2s; // Use is subject to license terms. import java.net.URL; import javax.swing.ImageIcon; public class Main { private static ClassLoader classLoader = null; /******************************************************************** */*from ww w.ja v a 2 s . c o m*/ * Get an ImageIcon. Return null if an ImageIcon could not be found. * ********************************************************************/ public static ImageIcon getImageIcon(String name) { URL url = getURL(name); if (url != null) { return new ImageIcon(url); } return null; } /******************************************************************** * * Given a resource name, extract a URL for the given resource. * ********************************************************************/ public static URL getURL(String name) { if (classLoader == null) { return null; } return classLoader.getResource(name); } }