Here you can find the source of getIcon(final String path)
public static ImageIcon getIcon(final String path)
//package com.java2s; import javax.swing.ImageIcon; public class Main { /**/* w w w . j av a 2s . c om*/ * Create an icon from the resource at path. * * @pre (path != null) **/ public static ImageIcon getIcon(final String path) { return new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(path)); } }