package image;
/**
* Robert.SU
*/
import java.awt.*;
import java.awt.event.*;
public class LoadFromAppli extends Frame{
private static final long serialVersionUID = 1L;
Image im;
public LoadFromAppli(){
im=Toolkit.getDefaultToolkit().getImage("E:""1.jpg");
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public void paint(Graphics g){
g.drawImage(im, 20, 20, this);
}
public static void main(String[] args){
LoadFromAppli f = new LoadFromAppli();
f.setSize(200,200);
f.show();
}
}
Paint方法显示图像
![](http://www.blogjava.net/babymouse/aggbug/210079.html)
文章来源:
http://www.blogjava.net/babymouse/archive/2008/06/23/210079.html