"d:/Freejava12\102-1.bmp"
你这个路径写得有点问题
怎么一个是

一个是
\
两个应该一样的

解决方案 »

  1.   

    这种方式是不支持bmp格式的,换个gif什么的试试
    而且文件名是:
    img=getImage(getCodeBase(),"d:/Freejava12/102-1.gif");//
      

  2.   

    看看applet的getImage(url,String)这个函数的参数注释:
    url - an absolute URL giving the base location of the image.
    name - the location of the image, relative to the url argument.
    注意name的注解,"relative to the url argument",翻译过来就是“相对于url的路径”。你在调用的时候不能使用什么"d:/Freejava12/102-1.gif"),这样定义是绝对路径,applet是无法找到图片位置的。
    如下假设,你的applet在c:\dir1\dir2;而你的图片位置在c:\dir1\dir2\images,那么应该这样写,
    getImage(getCodeBase(),"images/xx.xx");