It's so late to answer, but to someone this could be useful ...
Daniel Searson wrote:The exception you are getting is because you are in a Java applet and Java applets aren't allowed to access other files. The method getImage() in the Applet/JApplet class is a way around this (I'm not entirely sure how it works, but it does). Creating an ImageIcon using "new ImageIcon()" is not possible because it relies on normal I/O. So you get an access permission exception.
So, with ImageIcon you could do two things to avoid the AccessControlException because java.io.FilePermission:
1. To grant explicit permission to access local system resources ... resources that you will use in the applet.
You could see the next link about "Security and Permissions": http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html
2. To use ClassLoader
Everything is in the same path:
- index.html -> To run the applet
You could see the next link: http://www.leepoint.net/notes-java/GUI-lowlevel/graphics/45imageicon.html
By the way, ImageIcon doesn't allow to resize the image. You could see this post: https://coderanch.com/t/331731/GUI/java/Resize-ImageIcon
. It works perfect.