bannerLabel=new JLabel(new ImageIcon("banner.gif"));
logoLabel=new JLabel(new ImageIcon("logo.gif"));图片放在了同一目录下

解决方案 »

  1.   

    import java.awt.*;
    import javax.swing.JLabel;
    import javax.swing.*;
    /**
     * <p>Title: </p>
     * <p>Description: </p>
     * <p>Copyright: Copyright (c) 2003</p>
     * <p>Company: </p>
     * @author not attributable
     * @version 1.0
     */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);  }}
    用它试试