Java tutorial
import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import java.net.MalformedURLException; import java.net.URL; import javax.swing.JPanel; public class MainClass extends JPanel { public void load() throws MalformedURLException { URL url = new URL("image address"); Toolkit t = Toolkit.getDefaultToolkit(); Image im = t.getImage(url); MediaTracker mt = new MediaTracker(this); mt.addImage(im, 0); try { mt.waitForID(0); } catch (InterruptedException e) { System.err.println("Unexpected interrupt in waitForID!"); return; } if (mt.isErrorID(0)) { System.err.println("Couldn't load image file " + url); return; } } public static void main(String[] args) { } }