Loading Image in Applet
im trying to load an image into an applet with the following code:
File file =new File(path);
try{Picture = ImageIO.read(file);}
catch (IOException e){e.printStackTrace();}
it doesnt give an error there so the path and the rest works.
it gives an error when it is being drawn(loaded). eclipse console:
Exception in thread"AWT-EventQueue-1" java.lang.NullPointerException
at Main.paint(Main.java:57)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
and that repeating everytime it calls the paint method.
i think it is because of the sandbox. i don't want to sign my applet yet, i want to work with the .policy documents. I found this Eclipse-Auto-Created document next to my classes (java.policy.applet):
/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/
/* DO NOT EDIT */
grant{
permission java.security.AllPermission;
};
When i run the policytool.exe i find this in the warning log:
java.io.FileNotFoundException: C:\Documents and Settings\MyName\.java.policy (The system cannot find the file specified)
Now the Question:
Whats wrong with eclipses policy file and how do i fix it (if thats the problem)?
Thanks for reading all this :)

