It's not a secret anymore!*
The moose likes Applets and the fly likes Buttons with imagens in applet from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Buttons with imagens in applet from server" Watch "Buttons with imagens in applet from server" New topic
Author

Buttons with imagens in applet from server

Alexandre Melo
Greenhorn

Joined: Oct 03, 2002
Posts: 1
Hello,
i've an applet that have any buttons with image in your label.
like> button1.setIcon(new ImageIcon("images/cut.gif"));
but see that applet don't have permition to load it.
the error:
java.security.AccessControlException: access denied
(java.io.FilePermission images/new.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 javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at interpA.createMenus(interpA.java:178)
at interpA.<init>(interpA.java:42)
at interp.init(interp.java:41)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
who can i get around this problem ?
regards


Alexandre S. Melo
ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi,
u cannot load the image directly do the following in your applet
Image img =
getImage(getCodeBase(), "images/cut.gif");
and then use this image to your button
hope this helps


A$HI$H
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
"AlexandreMelo",
Please change your name to comply with the naming policy to which you agreed when you registered here..

For your publicly displayed name,
use a first name, a space, and a last name.

You can change your name
here:

You can also find the naming policy
here:
Thank You!


Rob
SCJP 1.4
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Buttons with imagens in applet from server