How do I load an image onto a JButton in an applet? new JButtion("foo.gif") throws a security exception.

John Zukowski

Passing a String to a JButton tries to load the image from a File. You need to create an ImageIcon with URL and pass that into the constructor:

URL picURL = getClass().getResource("mypic.gif");
ImageIcon icon = new ImageIcon(picURL);
JButton button = new JButton(icon);