ImageIcon ii = new ImageIcon(filename);
JLabel label = new JLabel(ii.getImage());

解决方案 »

  1.   

    JLabel label = new JLabel(text, icon);
      

  2.   

    找你的工程目录,如果你的目录是helloworld的话(你看一下,就是有helloworld.jpx的目录)你把图片(jpg,gif...),都放到helloworld.jpx同一个目录中,然后你就可以在设计对象的icon中找到。记住:
      是helloworld.jpx同一个目录中!
      

  3.   

    JLabel jLabel5 = new JLabel(new ImageIcon("James.jpg"));
      

  4.   

    public class tlabel extends JLabel {
      ImageIcon ima;
      String path = "d://11-5.jpg";  public void repaint(String path){
           this.path=path;
           repaint();
      }
      public void paint(Graphics g) {
       ima=new ImageIcon(path);
        g.drawImage(ima.getImage(),0,0,this.getWidth(),this.getHeight(),Color.BLUE,this);  }}
    试试吧,应该可以。
      

  5.   

    你在代码中private IconImage icon1 = new IconImage();
    然后就可以在属性选择框中的icon里找到icon1了