-
Notifications
You must be signed in to change notification settings - Fork 0
/
UI.java
88 lines (71 loc) · 2.3 KB
/
UI.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
package com.secProject;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class UI implements ActionListener {
JFrame f ;
JLabel l1,l2,l3;
JTextField t1;
JButton b1,b2;
JPanel p1 ;
UI() {
b1 = new JButton("Rules");
b1.setBounds(35, 300, 120, 25);
b1.setBackground(new Color(0, 0, 0));
b1.setForeground(new Color(225, 225, 225));
b1.setFocusable(false);
b1.addActionListener(this);
b2 = new JButton("Exit");
b2.setBounds(215, 300, 120, 25);
b2.setBackground(new Color(0, 0, 0));
b2.setForeground(new Color(225, 225, 225));
b2.setFocusable(false);
b2.addActionListener(this);
t1 = new JTextField();
t1.setBounds(30, 230, 300, 25);
t1.setFont(new Font("Times New Roman ", Font.PLAIN, 18));
l3 = new JLabel("Enter your name");
l3.setFont(new Font("Mongolian Bait", Font.BOLD, 18));
l3.setForeground(new Color(0, 0, 0));
l3.setBounds(100, 180, 300, 20);
l2 = new JLabel("INTELLIGENCE QUESTIONS");
l2.setFont(new Font("BoldItalic", Font.BOLD, 25));
l2.setForeground(new Color(0, 0, 0));
l2.setBounds(20, 80, 340, 45);
ImageIcon i1 = new ImageIcon("pink.jpg");
l1 = new JLabel();
l1.setBounds(50, 50, 480, 500);
l1.setIcon(i1);
p1 = new JPanel();
p1.setBounds(100, 100, 370, 400);
p1.setBackground(new Color(152, 152, 152, 70));
p1.setLayout(null);
p1.add(l2);
p1.add(l3);
p1.add(t1);
p1.add(b1);
p1.add(b2);
f = new JFrame("QUIZ");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(620, 650);
f.setResizable(false);
f.getContentPane().setBackground(new Color(146, 21, 37));
f.setLayout(null);
f.add(p1);
f.add(l1);
f.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1)
{
String name = t1.getText();
f.setVisible(false);
new Instructions(name);
}
else
{
System.exit(0);
}
}
}