我已经在Netbeans8中编写了Java小程序来显示jLabel
中的图像。在Netbeans中运行时,图像显示得很好。在HTML页面中,图像不会显示。图像与applet一起被放置在同一个目录中。当在浏览器中运行JLabel图像时,它不会显示在Applet中
下面是代码相关代码:
Images = new String[5];
Images[0] = "Chrysanthemum.jpg";
Images[1] = "Desert.jpg";
Images[2] = "Hydrangeas.jpg";
Images[3] = "Lighthouse.jpg";
Images[4] = "Penguins.jpg";
try {
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("Jellyfish.jpg")));
ImageIndex++;
} catch (Exception ex) {
System.out.println(ex.toString());
}
请帮助解决浏览器的这个问题。
你的意思是你使用浏览器来运行applet吗? – Tony