방치하기

홍대 자바 수업 : 패널 본문

홍익대 Java/수업

홍대 자바 수업 : 패널

Yi Junho 2009. 7. 28. 15:57
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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