关于第二个IOException ,你只需要加载io 包就可以了.
   import java.io.*;
  因为它是定义在io包里的.
   
  至于第一个错误,我不知道你的函数getImage(...)是在哪里定义的.  或者是哪个类的成员
函数.

解决方案 »

  1.   

    而且,JFrame没有getImage的方法呀。
    应该Toolkit.getDefaultToolkit().getImage(fd.getDirectory()+fd.getFile());
    你的程序是从applet程序中copy的吧?
      

  2.   

    我写的根本就不是JFrame呀!哪里让你认为我写的是swing啦!?
      

  3.   

    /**
         * Returns an <code>Image</code> object that can then be painted on
         * the screen. The <code>url</code> argument must specify an absolute
         * URL. The <code>name</code> argument is a specifier that is
         * relative to the <code>url</code> argument.
         * <p>
         * This method always returns immediately, whether or not the image
         * exists. When this applet attempts to draw the image on the screen,
         * the data will be loaded. The graphics primitives that draw the
         * image will incrementally paint on the screen.
         *
         * @param   url    an absolute URL giving the base location of the image.
         * @param   name   the location of the image, relative to the
         *                 <code>url</code> argument.
         * @return  the image at the specified URL.
         * @see     java.awt.Image
         */
        public Image getImage(URL url, String name) {
    try {
        return getImage(new URL(url, name));
    } catch (MalformedURLException e) {
        return null;
    }
        }
    上面是J2SDK1.4.1说明文档中对getImage方法的说明,getImage方法位于java.applet包中
      

  4.   

    是我写错了,应该是Frame。
    Frame也没有getImage的方法呀。