照样能用的,只要达到目的就行了,何必非要用最新的呢?况且java是向下兼容的。

解决方案 »

  1.   

    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.Image;public class BackgroundImage extends Applet
    {
    Image picture; boolean imageLoaded = false; public void init()
    {
    picture = getImage(getCodeBase(), "Image.gif"); // 装载图像
    Image offScreenImage = createImage(this.getSize().width,
    this.getSize().height); Graphics offScreenGC = offScreenImage.getGraphics(); // 获取Graphics对象
    offScreenGC.drawImage(picture, 0, 0, this); // 显示非屏幕图像
    } public void paint(Graphics g)
    {
    if (imageLoaded)
    {
    g.drawImage(picture, 0, 0, null); // 显示图像,第四参数为null,不是this
    showStatus("Done");
    } else
    showStatus("Loading image");
    } public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
    int h)
    {
    if (infoflags == ALLBITS)
    {
    imageLoaded = true;
    repaint();
    return false;
    } else
    return true;
    }
    }主要是把size()改成getSize()
    你的小错误好多啊。比较下好了