Java中怎样显示图片
Java 新手,想在Netbeens编写的Java程序中放图片,可是显示不出来是为什么???package first;
import java.awt.*;
import javax.swing.*;
public class First extends JFrame{
JSplitPane cf;
// JPanel mb1,mb2;
JList lb;
JLabel bq;
First(){
String[] jsj={"报警显示","数据查询"};
lb=new JList(jsj);
bq=new JLabel(new ImageIcon("源包/first/a.jpg"));//[/code]图片显示不出来
//mb1.add(bq);
//mb2.add(lb);
cf=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,lb,bq);
cf.setOneTouchExpandable(true);//小箭头,冲左冲右
this.add(cf);
this.setTitle("气体检测控制系统");
this.setSize(640,480);
this.setLocation(300,280);
//this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
First s1=new First();// TODO code application logic here
}
}