import java.awt.Canvas;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class A01 extends Frame implements WindowListener
{
public static void main(String[] args)
{
A01 f = new A01();
f.setSize(600,400);
f.setVisible(true);
}
public A01()
{
MyCanvas mc = new MyCanvas();
add("Center", mc);
addWindowListener(this);
}
class MyCanvas extends Canvas//이미지출력캔버스
{
public void paint(Graphics g)
{
Toolkit myToolkit = Toolkit.getDefaultToolkit();
// 경로 지정하시면 됩니다. "c:/android.jpg" 이런식으로.
Image myImage = myToolkit.getImage("c:/android.jpg");
g.drawImage(myImage , 0, 0, this);
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
}
'IT_Programming > Java' 카테고리의 다른 글
java HTML Parsing & ParserCallback (0) | 2008.08.20 |
---|---|
다중파일 전송 (0) | 2008.08.20 |
DefaultTreeCellRenderer test (0) | 2008.08.20 |
JInternalFrame (0) | 2008.08.20 |
java 24시간제를 12시간제로 바꾸기 (0) | 2008.08.20 |