-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhysicsHomePage.java
143 lines (118 loc) · 4.26 KB
/
PhysicsHomePage.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
/*
* 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 java.awt.event.*;
public class PhysicsHomePage extends java.awt.Frame {
static String subject;
/**
* Creates new form PhysicsHomePage
*/
public PhysicsHomePage(String subject) {
initComponents();
this.subject = subject;
}
public PhysicsHomePage() {
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() {
btnInsert = new java.awt.Button();
btnModify = new java.awt.Button();
btnDelete = new java.awt.Button();
btnGenerate = new java.awt.Button();
btnBack = 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);
btnInsert.setLabel("Insert Question");
btnInsert.setActionCommand("ins");
add(btnInsert);
btnInsert.setBounds(131, 49, 100, 24);
btnInsert.addActionListener(new ButtonClickListener());
btnModify.setLabel("Modify Question");
btnModify.setActionCommand("mod");
add(btnModify);
btnModify.setBounds(131, 110, 103, 24);
btnModify.addActionListener(new ButtonClickListener());
btnDelete.setLabel("Delete Question");
btnDelete.setActionCommand("del");
add(btnDelete);
btnDelete.setBounds(131, 166, 105, 24);
btnDelete.addActionListener(new ButtonClickListener());
btnGenerate.setLabel("Generate Test");
btnGenerate.addActionListener(new ButtonClickListener());
btnGenerate.setBounds(131, 236, 94, 24);
add(btnGenerate);
btnGenerate.setActionCommand("gen");
btnBack.setLabel("Back");
btnBack.setActionCommand("back");
add(btnBack);
btnBack.setBounds(323, 258, 43, 24);
btnBack.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 PhysicsHomePage().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private java.awt.Button btnBack;
private java.awt.Button btnDelete;
private java.awt.Button btnGenerate;
private java.awt.Button btnInsert;
private java.awt.Button btnModify;
// End of variables declaration//GEN-END:variables
public class ButtonClickListener implements ActionListener{
public void actionPerformed(ActionEvent e){
String command = e.getActionCommand();
if(command.equals("ins")){
btnInsert.getParent().setVisible(false);
new PhysicsInsertQuestion().setVisible(true);
}
if(command.equals("mod")){
btnModify.getParent().setVisible(false);
new PhysicsModifyQuestion().setVisible(true);
}
if(command.equals("del")){
btnDelete.getParent().setVisible(false);
new PhysicsDeleteQuestion().setVisible(true);
}
if(command.equals("back")){
btnBack.getParent().setVisible(false);
new Subject().setVisible(true);
}
if(command.equals("gen")){
btnGenerate.getParent().setVisible(false);
new GenerateTest().setVisible(true);
}
}
}
}