-
Notifications
You must be signed in to change notification settings - Fork 0
/
Task-4-->Rules
72 lines (60 loc) · 2.54 KB
/
Task-4-->Rules
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 Cod Soft");
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. You are trained to be a programmer and not a story teller, answer point to point" + "<br><br>" +
"2. Do not unnecessarily smile at the person sitting next to you, they may also not know the answer" + "<br><br>" +
"3. You may have lot of options in life but here all the questions are compulsory" + "<br><br>" +
"4. Crying is allowed but please do so quietly." + "<br><br>" +
"5. Only a fool asks and a wise answers (Be wise, not otherwise)" + "<br><br>" +
"6. Do not get nervous if your friend is answering more questions, may be he/she is doing " + "<br><br>" +
"7. Brace yourself, this paper is not for the faint hearted" + "<br><br>" +
"8. May you know more than what John Snow knows, Good Luck" + "<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");
}
}