drawImage(getImage(getCodeBase(),"test.jpg"), 100, 100,this)

解决方案 »

  1.   

    这就是我想要的:getImage(getCodeBase(),"test.jpg"),getImage()这个方法怎么实现的?请指点?
      

  2.   

    找到拉:
    在 Applet 里public Image getImage(URL url, String name) {
    try {
        return getImage(new URL(url, name));
    } catch (MalformedURLException e) {
        return null;
    }
    }
    public Image getImage(URL url) {
    return getAppletContext().getImage(url);
    }public AppletContext getAppletContext() {
    return stub.getAppletContext();
    }接口里:AppletContext getAppletContext();具体怎么回事我也不知道,你自己再看看
      

  3.   

    两种最简单的方法:
    1.用javax.swing.ImageIcon类
    用ImageIcon ii=new ImageIcon("文件的路径");
    ii.getImage()就是你要的Image对象.2.用javax.imageio.ImageIO类
    BufferedImage bi=ImageIO.read("文件路径");
    bi就是你要的Image对象