File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Buttons with imagens in applet from server

 
Alexandre Melo
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
ashish kulkarni
Ranch Hand
Posts: 131
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Ross
Bartender
Posts: 2205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic