-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI_Enrollment_Inquiry.java
More file actions
executable file
·169 lines (142 loc) · 4.86 KB
/
Copy pathUI_Enrollment_Inquiry.java
File metadata and controls
executable file
·169 lines (142 loc) · 4.86 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class UI_Enrollment_Inquiry extends JPanel
{
Enroll_inquiryControll eiController;
UI_Enrollment_Inquiry()
{
LineBorder pBorder = new LineBorder(Color.BLACK); // 패널 보더
TitledBorder title = new TitledBorder(pBorder, "등록/조회"); //타이틀 보더
title.setTitlePosition(TitledBorder.LEFT);
setBorder(title);
setLayout(new BorderLayout());
// 탭에 들어갈 각각의 패널 생성.
JPanel customerPanel = make_panel("고객명", "가입", "조회");
JPanel salesPanel = make_panel("기간", null, null);
JPanel employeePanel = make_panel("직원명", "직원등록", "조회");
JPanel menuPanel = make_panel("메뉴명", "메뉴등록", "조회");
// 탭에 패널 추가.
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab("고객", customerPanel);
tabbedPane.addTab("매출", salesPanel);
tabbedPane.addTab("직원", employeePanel);
tabbedPane.addTab("메뉴", menuPanel);
add(tabbedPane, BorderLayout.CENTER);
System.out.println("UI_Enrollment_Inquiry 패널 생성 완료..");
eiController = new Enroll_inquiryControll(tabbedPane, customerPanel,
salesPanel, employeePanel, menuPanel);
//customerPanel 액션 리스너 등록
((JButton)customerPanel.getComponent(2)).addActionListener(eiController);
((JButton)customerPanel.getComponent(3)).addActionListener(eiController);
// salesPanel에 액션 리스너 등록
((JButton)salesPanel.getComponent(1)).addActionListener(eiController);
// emploPanel 액션 리스너 등록
((JButton)employeePanel.getComponent(2)).addActionListener(eiController);
((JButton)employeePanel.getComponent(3)).addActionListener(eiController);
// menuPanel 액션 리스너 등록
((JButton)menuPanel.getComponent(2)).addActionListener(eiController);
((JButton)menuPanel.getComponent(3)).addActionListener(eiController);
}
// 패널 생성 메소드
private JPanel make_panel(String labelName, String btnName1, String btnName2)
{
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = new JPanel();
panel.setLayout(gbl);
LineBorder border = new LineBorder(Color.BLACK);
//label과 text area는 공통으로 쓰이니까.
JLabel label = new JLabel(labelName);
JTextArea textArea = new JTextArea(10, 15);
gbc.insets = new Insets(5, 5, 5, 5);
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridwidth = 1;
gbc.gridheight = 1;
if(btnName1 == null && btnName2 == null)
{
//label셋팅
label.setPreferredSize(new Dimension(10, 10));
label.setHorizontalTextPosition(JLabel.CENTER);
gbc.gridwidth = 1;
gbc.gridx = 1;
gbc.gridy = 1;
gbl.setConstraints(label, gbc);
panel.add(label);
//combo box 셋팅
JButton cal_btn = new JButton();
gbc.gridx = 2;
gbc.gridy = 1;
gbl.setConstraints(cal_btn, gbc);
panel.add(cal_btn);
// 텍스트영역 셋팅
textArea.setBorder(border);
gbc.gridwidth = 6;
gbc.gridheight = 7;
gbc.gridx = 0;
gbc.gridy = 3;
gbl.setConstraints(textArea, gbc);
panel.add(textArea);
}
else
{
JTextField textField = new JTextField();
JButton button1 = new JButton(btnName1);
JButton button2 = new JButton(btnName2);
// 레이블 셋팅
label.setPreferredSize(new Dimension(3, 3));
gbc.gridx = 0;
gbc.gridy = 0 ;
gbl.setConstraints(label, gbc);
panel.add(label);
// 텍스트필드 셋팅
textField.setPreferredSize(new Dimension(3, 3));
gbc.gridx = 0;
gbc.gridy = 1 ;
gbl.setConstraints(textField, gbc);
panel.add(textField);
// 등록버튼 셋팅
button1.setPreferredSize(new Dimension(5, 3));
gbc.gridx = 2;
gbc.gridy = 1 ;
gbl.setConstraints(button1, gbc);
panel.add(button1);
// 조회버튼 셋팅
button2.setPreferredSize(new Dimension(3, 3));
gbc.gridx = 3;
gbc.gridy = 1 ;
gbl.setConstraints(button2, gbc);
panel.add(button2);
// 텍스트영역 셋팅
textArea.setBorder(border);
gbc.gridwidth = 4;
gbc.gridheight = 4;
gbc.gridx = 0;
gbc.gridy = 2 ;
gbl.setConstraints(textArea, gbc);
panel.add(textArea);
}
return panel;
}
public Enroll_inquiryControll getController()
{
return this.eiController;
}
}