书上没有可以去网上找嘛,我随便找了个,你看看
http://www.cnblogs.com/tianguook/archive/2012/03/06/2382217.html

解决方案 »

  1.   

    @Override
    public void paint(Graphics g) {
    // TODO Auto-generated method stub
    g.drawImage(this.userImage, nowX, nowY, null);
    g.drawImage(this.dinosaursImage,100,30,null);
    }

    /*
     * 加载图片
     */
    private BufferedImage getImage(String image){

    BufferedImage bufferedImage = null;

    String classPath = Object.class.getResource("/").getPath();
    String imagePath = classPath.substring(1,classPath.length()-4).concat("image/");

    try {
    bufferedImage = ImageIO.read(new File(imagePath.concat(image) ));
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    return bufferedImage;
    }