I.E can't display ImageIcon
I code a simple applet (juste to display a ImageIcon) because I have the same problem with a big applet!
Firefox display correctly the ImageIcon but no Internet Explorer.
NB: I signed my applet before display it in the browser.
Please, Can someone help me!
Sorry for my english!
This is the simple code:
[import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Panel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
public class Image extends Applet{
private static final long serialVersionUID = 1L;
BorderLayout fl;
ImageIcon logo = new ImageIcon("logo.gif");
JButton B1 = new JButton(logo);
Panel Pasud=new Panel();
public void init(){
fl = new BorderLayout();
setLayout(fl);
add("North",Pasud);
Pasud.setLayout(new BorderLayout());
Pasud.setBackground(Color.white);
Pasud.add("North",B1);
B1.setBackground(Color.white);
B1.setBorderPainted(false);
B1.setVisible(true);
}
}
[1138 byte] By [
anis_bsa] at [2007-10-2 20:41:32]

i think it restricted to you to access local file, try to use URL to access your image file, i try modified your code, it run on firefox and ie.
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Panel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.net.URL; //added
public class Image extends Applet{
private static final long serialVersionUID = 1;
BorderLayout fl;
ImageIcon logo = null; //edited
JButton B1 = new JButton();
Panel Pasud=new Panel();
public void init(){
//start added
try {
logo = new ImageIcon(new URL("http://hostname_or_ip_address/imagefile")); //change hostname and image file
} catch (Exception e) {
e.printStackTrace();
}
//end add
fl = new BorderLayout();
setLayout(fl);
add("North",Pasud);
Pasud.setLayout(new BorderLayout());
Pasud.setBackground(Color.white);
B1.setIcon(logo); //added
Pasud.add("North",B1);
B1.setBackground(Color.white);
B1.setBorderPainted(false);
B1.setVisible(true);
}
}