-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhysicsInsertQuestion.java
145 lines (119 loc) · 4.45 KB
/
PhysicsInsertQuestion.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author abhiram
*/
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class PhysicsInsertQuestion extends java.awt.Frame {
/**
* Creates new form InsertPhysicsQuestion
*/
public PhysicsInsertQuestion() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
chkgrpQuestionType = new java.awt.CheckboxGroup();
btngrpQuestionType = new javax.swing.ButtonGroup();
chkMcq = new javax.swing.JRadioButton();
chkFill = new javax.swing.JRadioButton();
chkTrueFalse = new javax.swing.JRadioButton();
btnBack = new java.awt.Button();
lblDisplay = new java.awt.Label();
btnNext = new java.awt.Button();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
setLayout(new FlowLayout());
setSize(1000,1000);
btngrpQuestionType.add(chkMcq);
btngrpQuestionType.add(chkTrueFalse);
btngrpQuestionType.add(chkFill);
chkMcq.setText("MCQ");
add(chkMcq);
chkMcq.setBounds(41, 77, 55, 25);
chkFill.setText("Fill in the Blank");
add(chkFill);
chkFill.setBounds(41, 129, 115, 25);
chkTrueFalse.setText("True or False");
chkTrueFalse.setBounds(41, 186, 105, 25);
add(chkTrueFalse);
btnBack.setLabel("Back");
btnBack.setActionCommand("back");
btnBack.addActionListener(new ButtonClickListener());
add(btnBack);
btnBack.setBounds(272, 257, 43, 24);
if(Subject.Subject.equals("phy")){
lblDisplay.setText("Insert Physics Question");
}
if(Subject.Subject.equals("chem")){
lblDisplay.setText("Insert Chemistry Question");
}
btnNext.setLabel("Next");
btnNext.setActionCommand("next");
add(btnNext);
btnNext.setBounds(114, 257, 40, 24);
btnNext.addActionListener(new ButtonClickListener());
setLayout(null);
}// </editor-fold>//GEN-END:initComponents
/**
* Exit the Application
*/
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PhysicsInsertQuestion().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private java.awt.Button btnBack;
private javax.swing.JRadioButton chkFill;
private javax.swing.JRadioButton chkMcq;
private java.awt.Button btnNext;
private javax.swing.JRadioButton chkTrueFalse;
private javax.swing.ButtonGroup btngrpQuestionType;
private java.awt.Label lblDisplay;
private java.awt.CheckboxGroup chkgrpQuestionType;
// End of variables declaration//GEN-END:variables
public class ButtonClickListener implements ActionListener{
public void actionPerformed(ActionEvent e){
String command = e.getActionCommand();
if(command.equals("back")){
btnBack.getParent().setVisible(false);
new PhysicsHomePage().setVisible(true);
}
else if(chkMcq.isSelected()){
chkMcq.getParent().setVisible(false);
new PhysicsInsertMcqQuest().setVisible(true);
}
else if(chkFill.isSelected()){
chkFill.getParent().setVisible(false);
new PhysicsInsertFillInTheBlank().setVisible(true);
}
else if(chkTrueFalse.isSelected()){
chkTrueFalse.getParent().setVisible(false);
new PhysicsInsertTrueFalseQuest().setVisible(true);
}
}
}
}