방치하기

홍대 자바 수업 : 패널 본문

홍익대 Java/수업

홍대 자바 수업 : 패널

Yi Junho 2009. 7. 28. 15:57
반응형
import java.awt.event.*;
import java.awt.*;

class Fram extends Frame {
	Panel pan01,pan02,pan03;
	public Fram(){
	super("윈도우 이벤트");

	pan01 =new Panel();
	pan02 =new Panel();
	pan03 =new Panel();
	
	pan01.setBackground(Color.green);
	pan02.setBackground(Color.red);
	pan03.setBackground(Color.black);
	add(BorderLayout.NORTH,pan01);
	add(BorderLayout.CENTER,pan02);
	add(BorderLayout.EAST,pan03);

	pan01.add(new Button("Button 01"));
	pan02.add(new Button("Button 02-1"));
	pan03.add(new Button("Button 03-1"));

	setSize(300,200);
	setVisible(true);
	pan03.setVisible(false);

		addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e){
			dispose();
			System.exit(0);
		}
	}
	);
			addWindowListener(new WindowAdapter() {
		public void windowIconified(WindowEvent e){
			dispose();
			System.exit(0);
		}
	}
	);

	}

	

}


class Frame1  extends Frame
{
	public static void main(String[] args) throws Exception

	{
		new Fram();

	}
}
반응형
Comments