Image i=this.createImage(200,200); if(i==null) System.out.print("abc"); Graphics g=i.getGraphics(); g.drawString("aaa",20,30);Image is an abstract class and you cannot just create an instance of it directly and draw content to it.i suggest you use :BufferedImage i= new BufferedImage (200,200,TYPE_INT_RGB); if(i==null) System.out.print("abc"); Graphics2D g=i.createGraphics(); g.drawString("aaa",20,30); Image ii = (Image)i;
http://expert.csdn.net/Expert/TopicView1.asp?id=1821877
eg:
i=getImage(getCodeBase(),"hl.jpg");
if(i==null)
System.out.print("abc");
Graphics g=i.getGraphics(); g.drawString("aaa",20,30);Image is an abstract class and you cannot just create an instance of it directly and draw content to it.i suggest you use :BufferedImage i= new BufferedImage (200,200,TYPE_INT_RGB);
if(i==null)
System.out.print("abc");
Graphics2D g=i.createGraphics(); g.drawString("aaa",20,30);
Image ii = (Image)i;