forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRules.java
More file actions
72 lines (61 loc) · 2.49 KB
/
Rules.java
File metadata and controls
72 lines (61 loc) · 2.49 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
package quiz.application;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Rules extends JFrame implements ActionListener{
String name;
JButton start, back;
Rules(String name) {
this.name = name;
getContentPane().setBackground(Color.WHITE);
setLayout(null);
JLabel heading = new JLabel("Welcome " + name + " to Quiz Up");
heading.setBounds(50, 20, 700, 30);
heading.setFont(new Font("Viner Hand ITC", Font.BOLD, 28));
heading.setForeground(new Color(30, 144, 254));
add(heading);
JLabel rules = new JLabel();
rules.setBounds(20, 90, 700, 350);
rules.setFont(new Font("Tahoma", Font.PLAIN, 16));
rules.setText(
"<html>"+
"1. Time Limit: Each question has a 15-second time constraint." + "<br><br>" +
"2. Correct Answers: Every question has one correct answer." + "<br><br>" +
"3. 50-50 Lifeline: Players can use this lifeline once to eliminate two incorrect answer options." + "<br><br>" +
"4. Time Management: Players should answer within the 15-second time limit." + "<br><br>" +
"5. Scoring: Points awarded for correct answers." + "<br><br>" +
"6. Incorrect Answers: No penalties for wrong answers." + "<br><br>" +
"7. Lifeline Usage: Tap the 50-50 lifeline button during any question." + "<br><br>" +
"8. Fair Play: Follow the rules for fair and enjoyable gameplay." + "<br><br>" +
"<html>"
);
add(rules);
back = new JButton("Back");
back.setBounds(250, 500, 100, 30);
back.setBackground(new Color(30, 144, 254));
back.setForeground(Color.WHITE);
back.addActionListener(this);
add(back);
start = new JButton("Start");
start.setBounds(400, 500, 100, 30);
start.setBackground(new Color(30, 144, 254));
start.setForeground(Color.WHITE);
start.addActionListener(this);
add(start);
setSize(800, 650);
setLocation(350, 100);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == start) {
setVisible(false);
new Quiz(name);
} else {
setVisible(false);
new Login();
}
}
public static void main(String[] args) {
new Rules("User");
}
}