-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBellmanFordQuizScore.java
109 lines (89 loc) · 2.82 KB
/
BellmanFordQuizScore.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
import javax.swing.*;
import java.awt.event.*;
import java.awt.Font;
import java.util.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileNotFoundException;
public class BellmanFordQuizScore {
JFrame f;
JLabel l1, l2;
JButton b1, b2, b3, b4, b5;
String data;
public BellmanFordQuizScore() {
f = new JFrame("Score");
try {
File myObj = new File("score.txt");
Scanner myReader = new Scanner(myObj);
while (myReader.hasNextLine()) {
data = myReader.nextLine();
}
myReader.close();
} catch (FileNotFoundException e1) {
System.out.println("An error occurred.");
e1.printStackTrace();
}
l1 = new JLabel("Your Score Is", JLabel.CENTER);
l1.setFont(new Font("Verdana", Font.PLAIN, 36));
l1.setBounds(480, 50, 400, 60);
l2 = new JLabel(data, JLabel.CENTER);
l2.setFont(new Font("Verdana", Font.PLAIN, 48));
l2.setBounds(380, 225, 600, 80);
b1 = new JButton("Try Again");
b1.setFont(new Font("Verdana", Font.PLAIN, 18));
b1.setBounds(620, 500, 150, 40);
b2 = new JButton("Return To Algorithm");
b2.setFont(new Font("Verdana", Font.PLAIN, 18));
b2.setBounds(315, 550, 250, 40);
b3 = new JButton("Return To Main Menu");
b3.setFont(new Font("Verdana", Font.PLAIN, 18));
b3.setBounds(315, 620, 250, 40);
b4 = new JButton("Exit");
b4.setFont(new Font("Verdana", Font.PLAIN, 18));
b4.setBounds(830, 620, 250, 40);
b5 = new JButton("Return To Quiz Menu");
b5.setFont(new Font("Verdana", Font.PLAIN, 18));
b5.setBounds(830, 550, 250, 40);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(l1);
f.add(l2);
f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
f.dispose();
new BellmanFordQuiz();
}
});
b2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
f.dispose();
new BellmanFord();
}
});
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
f.dispose();
new MainMenu();
}
});
b4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
b5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
f.dispose();
new QuizMenu();
}
});
f.setExtendedState(JFrame.MAXIMIZED_BOTH);
f.setLayout(null);
f.setVisible(true);
}
}