component是个抽象类,public Image createImage(int width, int height)
并没有真正建立一个Image。

解决方案 »

  1.   

    可试试jLabel.setIcon(new ImageIcon(new java.net.URL(filepath);
      

  2.   

    看看我在下贴的回答.
    http://expert.csdn.net/Expert/TopicView1.asp?id=1821877
      

  3.   

    i=getImage(url,imagename)
    eg:
    i=getImage(getCodeBase(),"hl.jpg");
      

  4.   

    Image i=this.createImage(200,200);
        if(i==null)
          System.out.print("abc");
        Graphics g=i.getGraphics();       g.drawString("aaa",20,30);Image is an abstract class and you cannot just create an instance of it directly and draw content to it.i suggest you use :BufferedImage i= new BufferedImage (200,200,TYPE_INT_RGB);
        if(i==null)
          System.out.print("abc");
        Graphics2D g=i.createGraphics();       g.drawString("aaa",20,30);
    Image ii = (Image)i;