-
Notifications
You must be signed in to change notification settings - Fork 0
/
PanelControl.java
114 lines (90 loc) · 3.21 KB
/
PanelControl.java
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* 사용되는 패널 간 전환을 관리하는 CONTROL PANEL */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class PanelControl extends JPanel{
private FrogGame_new startPanel; // start
private FrogPanel playPanel;// play
private HelpPanel helpPanel; // help
private CreditPanel creditPanel; // credit
private ButtonListener btn;
public PanelControl(){
btn = new ButtonListener();
setBackground(Color.white);
setPreferredSize(new Dimension(800,600));
setLayout(null);
/*SET startPanel*/
startPanel = new FrogGame_new();
startPanel.setBounds(0,0,800,600);
startPanel.setVisible(true);
startPanel.button_1.addActionListener(btn);
startPanel.button_2.addActionListener(btn);
startPanel.button_3.addActionListener(btn);
startPanel.button_4.addActionListener(btn);
add(startPanel);
/*SET playPanel*/
playPanel = new FrogPanel();
playPanel.setBounds(0,0,800,600);
playPanel.setVisible(false);
playPanel.btnMain.addActionListener(btn);
add(playPanel);
/*SET helpPanel*/
helpPanel = new HelpPanel();
helpPanel.setBounds(0,0,800,600);
helpPanel.setVisible(false);
helpPanel.out.addActionListener(btn);
add(helpPanel);
/*SET creditPanel*/
creditPanel = new CreditPanel();
creditPanel.setBounds(0,0,800,600);
creditPanel.setVisible(false);
creditPanel.out_C.addActionListener(btn);
add(creditPanel);
} // constructor
private class ButtonListener implements ActionListener{
public void actionPerformed(ActionEvent event){
Object obj = event.getSource();
/*start -> play*/
if(obj == startPanel.button_1){
playPanel.setVisible(true);
startPanel.setVisible(false);
playPanel.F_Panel.setVisible(true);
playPanel.EndingPanel.setVisible(false);
playPanel.INI();
}
/*start -> help*/
if(obj == startPanel.button_2){
helpPanel.setVisible(true);
startPanel.setVisible(false);
}
/*help -> start*/
if(obj == helpPanel.out){
helpPanel.setVisible(false);
startPanel.setVisible(true);
}
/*start -> credit*/
if(obj == startPanel.button_3){
creditPanel.setVisible(true);
startPanel.setVisible(false);
}
/*credit -> start*/
if(obj == creditPanel.out_C){
creditPanel.setVisible(false);
startPanel.setVisible(true);
}
/*back to start*/
if(obj == playPanel.btnMain){
playPanel.setVisible(false);
startPanel.setVisible(true);
}
/*EXIT*/
if(obj == startPanel.button_4){
int answer = JOptionPane.showConfirmDialog(null,"정말 끝내개굴?");
if(answer == JOptionPane.YES_OPTION){
System.exit(0);
}
}
}
} // ButtonListener
} // PanelControl class