Here you can find the source of loadIcon(String icon)
public static ImageIcon loadIcon(String icon)
//package com.java2s; /**//ww w.j a v a 2s.c o m * * vsim * * This program is distributed under the terms of the GNU General Public License * The license is included in license.txt * * @author: Alejandro Vera * */ import javax.imageio.ImageIO; import javax.swing.*; import java.io.IOException; public class Main { public static ImageIcon loadIcon(String icon) { if (icon == null) { return null; } try { return new ImageIcon(ImageIO.read(ClassLoader.getSystemResourceAsStream("icons/" + icon))); } catch (IOException e) { e.printStackTrace(); return null; } } }