This repository was archived by the owner on Mar 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivateGUIInterface.java
More file actions
147 lines (126 loc) · 4.33 KB
/
activateGUIInterface.java
File metadata and controls
147 lines (126 loc) · 4.33 KB
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
146
147
import java.awt.event.*;
import javax.swing.*;
public class GUItester extends InteractiveDBTester {
/********************************************
The following commands implement a GUI panel using
the swing tool kit.
Individual buttons & text fields are defined and placed w/i
the overall frame.
The ActionListeners define the code to be executed when a button
is pressed (clicked) by a user.
*******************************************/
public static void activateGUIinterface() {
JFrame f=new JFrame("Employee DB Tester");
final JTextField tf1=new JTextField("");
JTextArea ta = new JTextArea();
ta.setBounds(50,350,400,300);
JButton b1=new JButton("Find");
b1.setBounds(50,25,110,30);
tf1.setBounds(170,25, 160,30);
tf1.setText("employee");
JButton b2=new JButton("Discontinue");
b2.setBounds(50,60,110,30);
final JTextField tf2=new JTextField("");
tf2.setBounds(170,60, 160,30);
tf2.setText("destnation");
JButton b3=new JButton("Search");
b3.setBounds(50,95,110,30);
final JTextField tf3=new JTextField("");
tf3.setBounds(170,95, 150,30);
tf3.setText("destination");
JButton b4=new JButton("Remove");
b4.setBounds(50,130,110,30);
final JTextField tf4=new JTextField("");
tf4.setBounds(170,130, 150,30);
tf4.setText("employee");
JButton b5=new JButton("Information");
b5.setBounds(50,165,110,30);
final JTextField tf5=new JTextField("");
tf5.setBounds(170,165, 150,30);
tf5.setText("Data5 here");
JButton b6=new JButton("Text interface");
b6.setBounds(50,305,130,30);
final JTextField tf6=new JTextField("");
tf6.setBounds(170,200, 150,30);
tf6.setText("Data6 here");
JButton b7=new JButton("Help");
b7.setBounds(50,235,110,30);
final JTextField tf7=new JTextField("");
tf7.setBounds(170,235, 150,30);
tf7.setText("Data7 here");
JButton b8=new JButton("Quit");
b8.setBounds(50,270,110,30);
JButton b9=new JButton("List DB");
b9.setBounds(50,200,110,30);
final JTextField tf8=new JTextField("");
tf8.setBounds(170,270, 150,30);
tf8.setText("Data8 here");
b1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushFind(tf1.getText()));
}
});
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushDiscontinue(tf2.getText()));
}
});
b3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushSearch(tf3.getText()));
}
});
b4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushRemove(tf4.getText()));
}
});
b5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushInformation());
}
});
b6.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
// Kill GUI control panel & activae text-based interface
f.setVisible(false); //you can't see now!
f.dispose(); //Destroy the JFrame object
Texttester.activateTextTester();
}
});
b7.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushHelp());
}
});
b8.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushQuit());
}
});
b9.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
ta.setText(pushList());
}
});
f.add(b1);f.add(tf1); f.add(ta);
f.add(b2);f.add(tf2);
f.add(b3);f.add(tf3);
f.add(b4);f.add(tf4);
f.add(b5);//f.add(tf5);
f.add(b9);//f.add(tf9);
f.add(b7);//f.add(tf7);
f.add(b8);//f.add(tf8);
f.add(b6);//f.add(tf6);
f.setBounds(50,50,500,700);
f.setLayout(null);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
GUIactive = true;
populateDB(args);
// Now build & activate the GUI testing interface
activateGUIinterface();
}
}