-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyPerformView.java
122 lines (97 loc) · 3.73 KB
/
MyPerformView.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
115
116
117
118
119
120
121
122
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
public class MyPerformView extends JFrame {
Container contentPane;
String [] header = {"공연", "날짜"};
Object[][] data = // SAMPLE입니다!!
{
{"공연", "날짜"},
{"곡성", "5/23"},
{"하이루", "1/2"},
{"즉새두", "2/3"},
};
private HomeView_host newhost;
private UpdatePerform1_View updatePerform1;
MyPerformView performView;
MyPerformView(ArrayList<Product> performList){
contentPane=this.getContentPane();
setBounds(0,0,700,700);
this.setVisible(true);
this.setLayout( null);
JPanel mypanel = new JPanel(new FlowLayout(1,50,5));
JLabel[] labelName = new JLabel[performList.size()];
JButton[] updateBtn = new JButton[performList.size()];
JButton[] delBtn = new JButton[performList.size()];
JButton backBtn = new JButton("뒤로가기");
JPanel[] performpanel = new JPanel[performList.size()]; // SAMPLE
for(int i=0; i<performpanel.length;i++)
{
FlowLayout fl = new FlowLayout(3,50,5);
labelName[i]= new JLabel(performList.get(i).getProductName());
updateBtn[i]= new JButton("수정");
delBtn[i]= new JButton("삭제");
performpanel[i] = new JPanel();
performpanel[i].setLayout(fl);
performpanel[i].add(labelName[i]); // mypanel 하나에 공연/삭제버튼/수정버튼 포함.
performpanel[i].add(updateBtn[i]);
performpanel[i].add(delBtn[i]);
delBtn[i].setHorizontalAlignment(SwingConstants.CENTER);
delBtn[i].setFont(new java.awt.Font("Gulim", 0, 14));
updateBtn[i].setFont(new java.awt.Font("Gulim", 0, 14));
labelName[i].setFont(new java.awt.Font("Gulim", 0, 14));
updateBtn[i].addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e) {
int index=0;
for(int i=0; i<performList.size();i++)
{
if(updateBtn[i]==e.getSource())
{
index=i;
break;
}
}
updatePerform1= new UpdatePerform1_View(performList.get(index).getPerformance()); // Main Form to show after the Login Form.
dispose();
}
});
delBtn[i].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
int index=0;
for(int i=0; i<performList.size();i++)
{
if(delBtn[i]==e.getSource())
{
index=i;
break;
}
}
dispose();
new DeletePerformController().eventDelete(performList.get(index), index);
performView= new MyPerformView(performList);
}
});
mypanel.add(performpanel[i]);
}
backBtn.setFont(new java.awt.Font("Gulim", 0, 14));
backBtn.setBounds(0,510,350,50);
backBtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
dispose();
newhost = new HomeView_host();
}
});
mypanel.add(backBtn);
// frame setting
mypanel.setVisible(true);
setSize(350,600);
this.setContentPane(mypanel);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}