Here you can find the source of createImageIcon(String path, String description)
public static ImageIcon createImageIcon(String path, String description)
//package com.java2s; //License from project: Open Source License import javax.swing.ImageIcon; public class Main { /** Returns an ImageIcon, or null if the path was invalid. */ public static ImageIcon createImageIcon(String path, String description) { return new ImageIcon(path, description); /*//from w w w . j a va2 s . co m java.net.URL imgURL = getClass().getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); } else { System.err.println("Couldn't find file: " + path); return null; } */ } }