-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOURefundPanel.java
More file actions
88 lines (70 loc) · 2.84 KB
/
OURefundPanel.java
File metadata and controls
88 lines (70 loc) · 2.84 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class OURefundPanel extends JPanel {
private int width = 100;
private int height = 30;
private JTextField usrInput;
private JPasswordField pwInput;
private String username;
private String password;
private MovieTheatreApp app;
private Color Red = new Color(139, 0, 0);
private Color Yellow = new Color(255, 248, 191);
private Color Orange = new Color(244, 138, 104);
public OURefundPanel(MovieTheatreApp app,UserDatabaseManager userDBM) {
this.app = app;
JLabel usrLabel = new JLabel("Email:");
usrLabel.setForeground(Red);
usrInput = new JTextField(15);
usrInput.setPreferredSize(new Dimension(width, height));
JButton submitButton = new JButton("Submit");
submitButton.setForeground(Red);
submitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RURefundPanel refund = app.getRURefundPanel();
refund.displayPurchasedTickets(usrInput.getText());
app.switchToRURefundPanel();
}
});
JButton backButton = new JButton("Back");
backButton.setForeground(Red);
backButton.addActionListener(e -> {
System.out.println("Going back to guest panel");
app.switchToGuest();
});
setLayout(new BorderLayout());
JPanel headerPanel = new JPanel();
JLabel title = new JLabel("Enter email used for ticket purchasing");
title.setForeground(Red);
headerPanel.add(title);
headerPanel.setBackground(Yellow);
this.add(headerPanel, BorderLayout.NORTH);
JPanel submitPanel = new JPanel();
submitPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
submitPanel.add(backButton);
submitPanel.add(submitButton);
this.add(submitPanel, BorderLayout.PAGE_END);
submitPanel.setBackground(Orange);
JPanel clientPanel = new JPanel();
clientPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
clientPanel.setBackground(Yellow);
int row = 0;
addComponent(clientPanel, usrLabel, 0, row, gbc);
addComponent(clientPanel, usrInput, 1, row++, gbc);
this.add(clientPanel, BorderLayout.CENTER);
}
private void addComponent(JPanel panel, Component component, int gridx, int gridy, GridBagConstraints gbc) {
gbc.gridx = gridx;
gbc.gridy = gridy;
panel.add(component, gbc);
}
private boolean validateEmail(UserDatabaseManager userDBM) {
boolean valid = true;
return valid;
}
}