-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminFMain.java
More file actions
290 lines (240 loc) · 9.48 KB
/
AdminFMain.java
File metadata and controls
290 lines (240 loc) · 9.48 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AdminFMain {
public static void main(String[] args) {
AdminFMain1 obj = new AdminFMain1();
}
};
class AdminFMain1 extends JFrame implements ActionListener {
JButton b1 = new JButton("ADD CUSTOMER");
JButton b2 = new JButton("VIEW CUSTOMER BILL DETAILS");
JButton b3 = new JButton("CALCULATE BILL");
JButton b4 = new JButton("UPDATE BILL STATUS");
public AdminFMain1() {
JFrame f = new JFrame("ADMIN OPERATIONS");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
// LABELS
JLabel l1 = new JLabel("SELECT OPERATION TO PERFORM");
l1.setBounds(450, 0, 400, 60);
l1.setFont(Font1);
f.add(l1);
// b1 for admin to add customer
b1.addActionListener(this);
b1.setBounds(450, 125, 250, 50);
f.add(b1);
// b2 for admin to view all customer details with payment status
b2.addActionListener(this);
b2.setBounds(450, 225, 250, 50);
f.add(b2);
// b3 to calculate a specific bill for a month
b3.addActionListener(this);
b3.setBounds(450, 325, 250, 50);
f.add(b3);
// b4 to updatebill status when customer pays bills
b4.addActionListener(this);
b4.setBounds(450, 425, 250, 50);
f.add(b4);
ImageIcon image;
try {
image = new ImageIcon(getClass().getResource("C:\\Users\\Ashika\\Desktop"), getName());
JLabel l4 = new JLabel(image);
l4.setBounds(0, 0, 400, 550);
l4.setBackground(Color.CYAN);
add(l4);
} catch (Exception e) {
System.out.println("Image not found..");
}
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1) {
JFrame f = new JFrame("ADD CUSTOMER");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
JLabel l1 = new JLabel("CUSTOMER USERNAME");
l1.setBounds(150, 50, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(450, 50, 200, 50);
f.add(t1);
JLabel l2 = new JLabel("CUSTOMER PASSWORD");
l2.setBounds(150, 150, 200, 50);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(450, 150, 200, 50);
f.add(t2);
JLabel l3 = new JLabel("PHONE NUMBER");
l3.setBounds(150, 250, 200, 50);
l3.setFont(Font1);
f.add(l3);
JTextField t3 = new JTextField(20);
t3.setBounds(450, 250, 200, 50);
f.add(t3);
JLabel l4 = new JLabel("EMAIL");
l4.setBounds(150, 350, 200, 50);
l4.setFont(Font1);
f.add(l4);
JTextField t4 = new JTextField(20);
t4.setBounds(450, 350, 200, 50);
f.add(t4);
JButton b1 = new JButton("ADD");
b1.setBounds(500, 450, 150, 50);
b1.setFont(Font1);
f.add(b1);
}
if (e.getSource() == b2) {
JFrame f = new JFrame("CUSTOMER BILL DETAILS");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
JLabel l1 = new JLabel("CUSTOMER USERNAME");
l1.setBounds(150, 200, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(450, 200, 200, 50);
f.add(t1);
JButton b1 = new JButton("SEARCH");
b1.setBounds(500, 400, 150, 50);
b1.setFont(Font1);
f.add(b1);
}
if (e.getSource() == b3) {
JFrame f = new JFrame("CUSTOMER BILL DETAILS");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
JLabel l1 = new JLabel("UNITS CONSUMED");
l1.setBounds(150, 50, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(450, 50, 200, 50);
f.add(t1);
JLabel l2 = new JLabel("SLAB APPLICABLE");
l2.setBounds(150, 150, 200, 50);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(450, 150, 200, 50);
f.add(t2);
JLabel l3 = new JLabel("COST PER UNIT");
l3.setBounds(150, 250, 200, 50);
l3.setFont(Font1);
f.add(l3);
JTextField t3 = new JTextField(20);
t3.setBounds(450, 250, 200, 50);
f.add(t3);
JLabel l4 = new JLabel("TOTAL AMOUNT");
l4.setBounds(150, 350, 200, 50);
l4.setFont(Font1);
f.add(l4);
JTextField t4 = new JTextField(20);
t4.setBounds(450, 350, 200, 50);
f.add(t4);
JButton b1 = new JButton("GENERATE BILL");
b1.setBounds(450, 450, 200, 50);
b1.setFont(Font1);
f.add(b1);
}
if (e.getSource() == b4) {
JFrame f = new JFrame("UPDATE BILL DETAILS");
f.setVisible(true);
f.setSize(800, 800);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
JLabel l1 = new JLabel("CUSTOMER USERNAME");
l1.setBounds(150, 50, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(450, 50, 200, 50);
f.add(t1);
// String f1[] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",
// "JULY", "AUGUST", "SEPTEMBER",
// "OCTOBER", "NOVEMBER", "DECEMBER" };
// JComboBox cb = new JComboBox(f1);
// cb.setBounds(150, 200, 100, 50);
// f.add(cb);
JRadioButton month1 = new JRadioButton("JANUARY");
month1.setBounds(50, 150, 150, 20);
JRadioButton month2 = new JRadioButton("FEBRUARY");
month2.setBounds(250, 150, 150, 20);
JRadioButton month3 = new JRadioButton("MARCH");
month3.setBounds(450, 150, 150, 20);
JRadioButton month4 = new JRadioButton("APRIL");
month4.setBounds(650, 150, 150, 20);
JRadioButton month5 = new JRadioButton("MAY");
month5.setBounds(50, 250, 150, 20);
JRadioButton month6 = new JRadioButton("JUNE");
month6.setBounds(250, 250, 150, 20);
JRadioButton month7 = new JRadioButton("JULY");
month7.setBounds(450, 250, 150, 20);
JRadioButton month8 = new JRadioButton("AUGUST");
month8.setBounds(650, 250, 150, 20);
JRadioButton month9 = new JRadioButton("SEPTEMBER");
month9.setBounds(50, 350, 150, 20);
JRadioButton month10 = new JRadioButton("OCTOBER");
month10.setBounds(250, 350, 150, 20);
JRadioButton month11 = new JRadioButton("NOVEMBER");
month11.setBounds(450, 350, 150, 20);
JRadioButton month12 = new JRadioButton("DECEMBER");
month12.setBounds(650, 350, 150, 20);
month1.setFont(Font1);
month2.setFont(Font1);
month3.setFont(Font1);
month4.setFont(Font1);
month5.setFont(Font1);
month6.setFont(Font1);
month7.setFont(Font1);
month8.setFont(Font1);
month9.setFont(Font1);
month10.setFont(Font1);
month11.setFont(Font1);
month12.setFont(Font1);
f.add(month1);
f.add(month2);
f.add(month3);
f.add(month4);
f.add(month5);
f.add(month6);
f.add(month7);
f.add(month8);
f.add(month9);
f.add(month10);
f.add(month11);
f.add(month12);
JRadioButton status1 = new JRadioButton("PAID");
status1.setBounds(150, 600, 100, 20);
JRadioButton status2 = new JRadioButton("UNPAID");
status2.setBounds(450, 600, 100, 20);
// Setting default state to be unpaid
status2.setSelected(true);
status1.setFont(Font1);
status2.setFont(Font1);
f.add(status1);
f.add(status2);
// Allowing admin to only select paid or unpaid at a time
ButtonGroup gen = new ButtonGroup();
gen.add(status1);
gen.add(status2);
JButton b1 = new JButton("UPDATE");
b1.setBounds(500, 700, 150, 50);
b1.setFont(Font1);
f.add(b1);
}
;
}
};