-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI_MenuStatus.java
More file actions
executable file
·84 lines (71 loc) · 1.91 KB
/
UI_MenuStatus.java
File metadata and controls
executable file
·84 lines (71 loc) · 1.91 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
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
public class UI_MenuStatus extends JPanel
{
JButton[] button;
MenuControll mController;
UI_MenuStatus()
{
button = new JButton[20];
LineBorder pBorder = new LineBorder(Color.BLACK); // 패널 보더
TitledBorder title = new TitledBorder(pBorder, "메뉴"); //타이틀 보더
title.setTitlePosition(TitledBorder.LEFT);
setBorder(title);
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
setLayout(gbl);
gbc.insets = new Insets(5, 5, 5, 5);
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridwidth = 1;
gbc.gridheight = 1;
int i;
for(i = 0; i < 10; i++)
{
button[i] = new JButton();
button[i].setPreferredSize(new Dimension(10, 3));
gbc.gridx = 0;
gbc.gridy = i;
gbl.setConstraints(button[i], gbc);
add(button[i]);
}
for(; i < button.length; i++)
{
button[i] = new JButton();
button[i].setPreferredSize(new Dimension(10, 3));
if(i >= 10)
{
gbc.gridx = 1;
gbc.gridy = i - 10;
}
else
{
gbc.gridx = 0;
gbc.gridy = i;
}
gbl.setConstraints(button[i], gbc);
add(button[i]);
}
System.out.println("UI_MenuStatus 패널 생성 완료..");
// 컨트롤러 생성 및, 액션 리스너로 각 버튼에 등록.
mController = new MenuControll(button);
for(i=0; i<20; i++)
button[i].addActionListener(mController);
}
public MenuControll getController()
{
return this.mController;
}
}