forked from fayecamilleburi/TopologicalSort
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoMatch.java
More file actions
140 lines (116 loc) · 4.35 KB
/
NoMatch.java
File metadata and controls
140 lines (116 loc) · 4.35 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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NoMatch extends JFrame implements ActionListener {
private JButton backButton, exitButton, againButton;
public NoMatch() {
initComponents();
}
private void initComponents() {
setTitle("GRWM");
setSize(new Dimension(1000, 580));
setResizable(false);
setLocationRelativeTo(null);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
add(mainPanel());
}
public JPanel mainPanel() {
JPanel panel = new JPanel(null);
panel.setBounds(0, 0, 1000, 580);
panel.setBackground(new Color(0xEFE7DD));
panel.add(headerPanel());
panel.add(contentPanel());
return panel;
}
public JPanel headerPanel() {
JPanel panel = new JPanel(null);
panel.setSize(1280, 70);
panel.setBackground(new Color(0xEFE7DD));
backButton = new JButton("Back");
backButton.setBounds(40, 20, 100, 30);
backButton.setBackground(new Color(0x9B4922));
backButton.setForeground(new Color(0xEFE7DD));
backButton.setFont(new Font("Arial", Font.BOLD, 12));
backButton.setFocusable(false);
backButton.addActionListener(this::actionPerformedBack);
panel.add(backButton);
exitButton = new JButton("Exit");
exitButton.setBounds(844, 20, 100, 30);
exitButton.setBackground(new Color(0x9B4922));
exitButton.setForeground(new Color(0xEFE7DD));
exitButton.setFont(new Font("Arial", Font.BOLD, 12));
exitButton.setFocusable(false);
exitButton.addActionListener(this::actionPerformedExit);
panel.add(exitButton);
return panel;
}
public JPanel contentPanel() {
JPanel panel = new JPanel(null);
panel.setBounds(40, 70, 904, 430);
panel.setBackground(new Color(0x764B36));
JLabel icon = new JLabel(":<");
icon.setBounds(0, 65, 904, 55);
icon.setForeground(new Color(0xEFE7DD));
icon.setFont(new Font("Arial", Font.BOLD, 50));
icon.setHorizontalAlignment(JLabel.CENTER);
panel.add(icon);
JLabel heading = new JLabel("Don't worry, " + Prompt.name + "!");
heading.setBounds(0, 125, 904, 65);
heading.setForeground(new Color(0xEFE7DD));
heading.setFont(new Font("Arial", Font.BOLD, 60));
heading.setHorizontalAlignment(JLabel.CENTER);
panel.add(heading);
String content = "<html><div style='text-align: center;'>"
+ "I think we can get more ready next time.<br>"
+ "There's always tomorrow, right?</div></html>";
JLabel text = new JLabel(content);
text.setBounds(0, 215, 904, 50);
text.setForeground(new Color(0xEFE7DD));
text.setFont(new Font("Arial", Font.ITALIC, 20));
text.setHorizontalAlignment(JLabel.CENTER);
panel.add(text);
againButton = new JButton("Get Ready With Me Again");
againButton.setBounds(352, 305, 200, 30);
againButton.setBackground(new Color(0x9B4922));
againButton.setForeground(new Color(0xEFE7DD));
againButton.setFont(new Font("Arial", Font.BOLD, 12));
againButton.setFocusable(false);
againButton.addActionListener(this);
panel.add(againButton);
return panel;
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == againButton) {
SwingUtilities.invokeLater(() -> {
new Prompt().setVisible(true);
});
disposeAllFrames();
}
}
private void disposeAllFrames() {
Window[] windows = Window.getWindows();
for (Window window : windows) {
if (window instanceof JFrame) {
window.dispose();
}
}
}
public void actionPerformedBack(ActionEvent e) {
if (e.getSource() == backButton) {
dispose();
}
}
public void actionPerformedExit(ActionEvent e) {
if (e.getSource() == exitButton) {
SwingUtilities.invokeLater(() -> {
new Credits().setVisible(true);
});
dispose();
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
new NoMatch().setVisible(true);
});
}
}