A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Image not loading
Joined: May 05, 2005
Aug 30, 2005 04:53:00
i create an
with a label attached to it. I load an
in a label:
JLabel label=new JLabel(new ImageIcon("zone1.jpg"));
Now when I load html file directly, applet is working perfectly fine.
but when i use server to display applet its giving security exception error..
How can we display image?
Joined: Aug 10, 2005
Aug 30, 2005 07:57:00
Where does the ImageIcon() constructor try to read the image file from?
Is it from the server? That should be no problem!
Or is it from the local system? That will give you a Security exception.
Read the doc for the ImageIcon constructors and find one that will work when the image needs to come from the server. This many involve other classes such as URL.
When you get an error, please POST the FULL text of the message, don't edit it.
It is sorta covered in the
JavaRanch Style Guide
subject: Image not loading
Adding an Image to JPanel using NetBeans IDE
Problem Repainting Panel
Image problem in SWING
Applet, How to get the image displayed PLEASE HELP
Adding an image to a frame
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014