forked from Kaushikkotian14/ONLINE-EXAM-APP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam1.java
102 lines (79 loc) · 2.33 KB
/
exam1.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
package HACK;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class exam1 extends JFrame implements ActionListener{
JLabel l1,l2;
JRadioButton a,b,c,d;
JButton next;
int rdX=75,rdW=140,rdH=50;
ButtonGroup opt;
exam1() {
setSize(1000, 700);
JLabel lable=new JLabel();
l1 = new JLabel("JAVA BASICS");
l1.setBounds(400, 20, 1000, 100);
l1.setFont(new Font("Tahoma", Font.BOLD, 30));
add(l1);
Border bdr= BorderFactory.createLineBorder(Color.black,3); //Border to window
lable.setBorder(bdr);
lable.setOpaque(true);
l2 = new JLabel("1. Which of the following is used to find and fix bugs in Java programs?");
l2.setBounds(30, 130, 1000, 100);
l2.setFont(new Font("Tahoma", Font.PLAIN, 22));
add(l2);
opt = new ButtonGroup();
a = new JRadioButton("a) JVM");
a.setBounds(rdX, 270, rdW, rdH);
opt.add(a);
add(a);
b = new JRadioButton("b) JRE");
b.setBounds(rdX, 340, rdW, rdH);
opt.add(b);
add(b);
c = new JRadioButton("c) JDK");
c.setBounds(rdX, 410, rdW, rdH);
opt.add(c);
add(c);
d = new JRadioButton("d) JDB");
d.setBounds(rdX, 490, rdW, rdH);
opt.add(d);
add(d);
next = new JButton("Next");
next.setBounds(770,500,100,40);
next.addActionListener(this);
add(next);
setLayout(null);
setLocationRelativeTo(null);
setVisible(true);
}
public static void main(String[] args)
{
new exam1();
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource()==next) {
new login();
this.setVisible(false);
}
String option = null;
if(a.isSelected())
{
option = "a) JVM";
}
else if(b.isSelected())
{
option = "b) JRE";
}
else if (c.isSelected())
{
option = "c)JDK";
}
else if(d.isSelected())
{
option = "d)JDB";
}
}
}