import java.awt.*;
import javax.swing.*;
public class JLabelDemo extends JApplet {
public void init() {
Container contentPane = getContentPane();
Icon ii = new ImageIcon("france.gif"); //这里错误
JLabel jl = new JLabel("France", ii, JLabel.CENTER);
contentPane.add(jl);
}
}
import javax.swing.*;
public class JLabelDemo extends JApplet {
public void init() {
Container contentPane = getContentPane();
Icon ii = new ImageIcon("france.gif"); //这里错误
JLabel jl = new JLabel("France", ii, JLabel.CENTER);
contentPane.add(jl);
}
}
你可能没有设置吧!
两个问题是你没有权限访问图片,
在dos下输入policytool
命令,搞一些设置
...
ImageIcon ii = new ImageIcon(getCodeBase(),"france.gif");
...