Posted on 2008-06-23 15:43
Robert Su 阅读(829)
评论(0) 编辑 收藏
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方法显示图像