public LoginFrame() {
super();
this.setIconImage(EditorUtils.createIcon("email.gif").getImage());
getContentPane().setLayout(null);
jFrameValidate();
setTitle("登录邮箱");
JLabel backgroundLabel = new JLabel();
backgroundLabel.setBounds(0, 0, 768, 540);
backgroundLabel.setText("<html><img width=776 height=574 src='"
+ this.getClass().getResource("/loginBg.jpg") + "'></html>");
在myeclipse提示图片加载失败,email.gif放在res文件夹中,res和LoginFrame所处的文件夹src处于同一文件夹中。应该怎么设置路径呢?
super();
this.setIconImage(EditorUtils.createIcon("email.gif").getImage());
getContentPane().setLayout(null);
jFrameValidate();
setTitle("登录邮箱");
JLabel backgroundLabel = new JLabel();
backgroundLabel.setBounds(0, 0, 768, 540);
backgroundLabel.setText("<html><img width=776 height=574 src='"
+ this.getClass().getResource("/loginBg.jpg") + "'></html>");
在myeclipse提示图片加载失败,email.gif放在res文件夹中,res和LoginFrame所处的文件夹src处于同一文件夹中。应该怎么设置路径呢?
XXX.class.getClassLoader().getResourceAsStream(name)