AWT Window Event 처리 및 Adapter 사용

import java.awt.*;
import java.awt.event.*;

class WinEvent extends Frame implements WindowListener
{
	public WinEvent(){
		super("::WinEvent::");
		addWindowListener(this);
	}//생성자----------------------
	public void windowActivated(WindowEvent e) {}
	public void windowDeactivated(WindowEvent e) {}
	public void windowOpened(WindowEvent e) {}
	public void windowClosed(WindowEvent e) {}
	public void windowClosing(WindowEvent e) {
		System.exit(0);
	}
	public void windowIconified(WindowEvent e) {}  //최소화
	public void windowDeiconified(WindowEvent e){} //원래창 크기로

	public static void main(String[] args) 
	{
		WinEvent we=new WinEvent();
		we.setSize(300,300);
		we.setVisible(true);
	}
}
/////////////////////Adapter 사용시//////////////////////////////////////////////////////////////////////////////////////
import java.awt.*;
import java.awt.event.*;

class WinEvent2 extends Frame
{
	public WinEvent2(){
		super("::WinEvent2::");
		WinHandler w = new WinHandler();
		addWindowListener(w);
	}//생성자---------------
	//어댑터를 상속받으면 내가 필요한 추상메소드만 오버라이딩해서 사용하면 된다
	class WinHandler extends WindowAdapter
	{
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}

	}/////////////////////
	public static void main(String[] args) 
	{
		WinEvent2 we=new WinEvent2();
		we.setSize(300,300);
		we.setVisible(true);
	}
}///////////////////////////