Originally posted by shalini gnana:
Its saying that Applet loading failed..
Why does applet loading fail - there should be an exception in the Java Console - what does it say?
It throws the following error:
ava.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\8563\JavaApplication2\image\folder.gif read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It's better to use a relative path to the image. If your HTML file is stored in C:\Documents and Settings\8563\JavaApplication2, the following will create a relative URL for you:
but if the code moves to a different class -which is the case in your code- you'll need a reference to the Applet object. You could pass that into the ImagePanel class in the constructor.
I tried to add in the way you said..
Actually, no, you didn't. I suggested passing a reference to the applet instance to the ImagePanel class in its constructor. What you did was to try to create a new instance of the applet class:
I mentioned to you that one should never do that in your question about Gantt charts.