Here you can find the source of getResourceIcon(JFrame fr, String name, Class callingClass)
public static void getResourceIcon(JFrame fr, String name, Class callingClass)
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { /**/*from ww w . j av a 2 s .c o m*/ * Set a icon for given frame * CallingClass is used to determine where to find resource... */ public static void getResourceIcon(JFrame fr, String name, Class callingClass) { try { ImageIcon i = null; i = new ImageIcon(callingClass.getResource(name)); fr.setIconImage(i.getImage()); } catch (Exception e) { System.out.println("Icon not loaded: " + name); } } /** * Set a icon for given frame * CallingClass is used to determine where to find resource... */ public static void getResourceIcon(JInternalFrame fr, String name, Class callingClass) { try { ImageIcon i = null; i = new ImageIcon(callingClass.getResource(name)); fr.setFrameIcon(i); } catch (Exception e) { System.out.println("Icon not loaded: " + name); } } }