Here you can find the source of getImage(String path)
public static Image getImage(String path)
//package com.java2s; /**// w w w .j a va2 s .c o m * Copyright 2013 by PanicLauncher and Contributors * * This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/. */ import java.awt.Image; import java.net.URL; import javax.swing.ImageIcon; public class Main { public static Image getImage(String path) { URL url = System.class.getResource(path); if (url == null) { System.err.println("Unable to load image: " + path); } ImageIcon icon = new ImageIcon(url); return icon.getImage(); } }