Java tutorial
//package com.java2s; //License from project: Open Source License import java.net.URL; import javax.swing.ImageIcon; public class Main { public static final ImageIcon loadIcon(Class pRootClass, String strPath) { URL imgURL = pRootClass.getResource(strPath); if (imgURL != null) return new ImageIcon(imgURL); else return null; } }