-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPossibleState.java
48 lines (42 loc) · 1.61 KB
/
PossibleState.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
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class PossibleState extends JFrame implements CancelTicketState{
private static PossibleState singleton = new PossibleState();
private PossibleState(){};
public static CancelTicketState getInstance(){
return singleton;
}
public CancelTicketState checkDay(Date date){
if(date.before(new Date()))
return ImpossibleState.getInstance();
else
return singleton;
}
public void makeCancelBtn(JPanel orderpanel, JButton[] cancelBtn, int index, int size){
cancelBtn[index] = new JButton("예매취소");
cancelBtn[index].setBounds(240,50*index,90,50);
cancelBtn[index].setFont(new java.awt.Font("Gulim", 0, 15));
orderpanel.add(cancelBtn[index]);
cancelBtn[index].addActionListener(new ActionListener() // 공연등록 버튼 페이지 경로
{
public void actionPerformed(ActionEvent e) {
int index=0;
for(int i=0; i<size;i++)
{
if(cancelBtn[i]==e.getSource())
{
index=i;
break;
}
}
DBHelper.getInstance().cancelTicket(DBHelper.getInstance().getAudience().getTickets().get(index));
OrderView newOrderView=new OrderView(); // Main Form to show after the Login Form.
dispose();
}
});
}
}