请问怎样在小应用程序中显示图象啊?
//<applet code=test.class width=200 height=200>
//</applet>
import java.applet.*; import java.awt.*; import java.net.*; import java.applet.Applet;
public class test extends Applet { public void paint(Graphics g) { try{ URL codebase=new URL("file:/d/imge/1.gif"); Image a=getImage(codebase); g.drawString("getfile="+codebase.getFile(),10,30); g.drawImage(a,10,50,this); } catch(MalformedURLException e) { g.drawString("Image not found",30,30); } }
} 怎么不行啊?