问题描述
我写好了一applet类,效果是动态显示一张图片,在eclipse中直接runasapplet能出结果。但,加到前台后,图片出不来。、这是前台代码://index.jsp<appletcode="ScrollImage.class"width="150"height="100"><paramname="Image"value="L.jpg">Sorry,yourbrowserdoesn'tsupportJava(tm).</applet>如果我把这个index.jsp改成index.html,双击就能直接正确的运行出来。这是怎么回事????诚望赐教!!!具体报错如下:L.jpg已载入图象:http://127.0.0.1:8080/MyApplet/L.jpg-1,-1java.lang.IllegalArgumentException:Width(-1)andheight(-1)cannotbe<=0atjava.awt.image.DirectColorModel.createCompatibleWritableRaster(UnknownSource)atsun.awt.Win32GraphicsConfig.createAcceleratedImage(UnknownSource)atsun.awt.windows.WComponentPeer.createImage(UnknownSource)atjava.awt.Component.createImage(UnknownSource)atScrollImage.init(ScrollImage.java:68)atsun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)异常:java.lang.IllegalArgumentException:Width(-1)andheight(-1)cannotbe<=0java.lang.NullPointerExceptionatScrollImage.start(ScrollImage.java:80)atsun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)异常:java.lang.NullPointerExceptionL.jpg已载入图象:http://127.0.0.1:8080/MyApplet/L.jpg-1,-1java.lang.IllegalArgumentException:Width(-1)andheight(-1)cannotbe<=0atjava.awt.image.DirectColorModel.createCompatibleWritableRaster(UnknownSource)atsun.awt.Win32GraphicsConfig.createAcceleratedImage(UnknownSource)atsun.awt.windows.WComponentPeer.createImage(UnknownSource)atjava.awt.Component.createImage(UnknownSource)atScrollImage.init(ScrollImage.java:68)atsun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)异常:java.lang.IllegalArgumentException:Width(-1)andheight(-1)cannotbe<=0java.lang.NullPointerExceptionatScrollImage.start(ScrollImage.java:80)atsun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)异常:java.lang.NullPointerException
解决方案
解决方案二:
不懂!
解决方案三:
是不是图片路径的问题?