-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstpage.java
More file actions
300 lines (231 loc) · 8.69 KB
/
firstpage.java
File metadata and controls
300 lines (231 loc) · 8.69 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
291
292
293
294
295
296
297
298
299
300
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class firstpage {
public static void main(String[] args) {
class1 obj = new class1();
}
};
class class1 implements ActionListener {
JLabel l1 = new JLabel("ADMIN OR CUSTOMER");
JButton b1 = new JButton("ADMIN");
JButton b2 = new JButton("CUSTOMER");
// b3 admin sign in b4 admin log in
// b5 customer sign in b6 customer log in
JButton b3 = new JButton("SIGN IN");
JButton b4 = new JButton("LOG IN");
JButton b5 = new JButton("SIGN IN");
JButton b6 = new JButton("LOG IN");
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
public class1() {
JFrame f = new JFrame("CUSTOMER SIGN IN");
f.setVisible(true);
f.setSize(300, 300);
f.setLayout(null);
// buttons of first frame to choose whether user is admin or listener,b1 is
// admin,b2 is customer
b1.setBounds(75, 50, 100, 50);
b2.setBounds(75, 150, 100, 50);
f.add(b1);
f.add(b2);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
l1.setFont(Font1);
l1.setBounds(50, 0, 150, 50);
b1.addActionListener(this);
b2.addActionListener(this);
// b3 admin sign in,b4 admin log in
// b5 customer sign in,b6 customer log in
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1) {
JFrame f = new JFrame("ADMIN");
f.setVisible(true);
f.setSize(300, 300);
f.setLayout(null);
JLabel l1 = new JLabel("SIGN IN OR LOG IN");
l1.setFont(Font1);
l1.setBounds(50, 0, 200, 50);
b3.setBounds(75, 50, 100, 50);
b4.setBounds(75, 150, 100, 50);
f.add(l1);
f.add(b3);
f.add(b4);
}
if (e.getSource() == b2) {
JFrame f = new JFrame("CUSTOMER");
f.setVisible(true);
f.setSize(300, 300);
f.setLayout(null);
JLabel l1 = new JLabel("SIGN IN OR LOG IN");
l1.setFont(Font1);
l1.setBounds(50, 0, 200, 50);
b5.setBounds(75, 50, 100, 50);
b6.setBounds(75, 150, 100, 50);
f.add(l1);
f.add(b5);
f.add(b6);
}
if (e.getSource() == b3) {
JFrame f = new JFrame("ADMIN SIGN IN");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
// try to insert background image in label
ImageIcon image;
try {
image = new ImageIcon(getClass().getResource(""));
JLabel l4 = new JLabel(image);
l4.setBounds(0, 0, 400, 550);
l4.setBackground(Color.CYAN);
f.add(l4);
} catch (Exception e3) {
System.out.println("Image not found..");
}
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
JLabel l1 = new JLabel("USERNAME");
l1.setBounds(450, 100, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(575, 100, 150, 50);
f.add(t1);
JLabel l2 = new JLabel("PASSWORD");
l2.setBounds(450, 200, 200, 50);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(575, 200, 150, 50);
f.add(t2);
JLabel l3 = new JLabel("ADMIN CODE");
l3.setBounds(450, 300, 200, 50);
l3.setFont(Font1);
f.add(l3);
JTextField t3 = new JTextField(20);
t3.setBounds(575, 300, 150, 50);
f.add(t3);
JButton b = new JButton("SIGN IN");
b.setBounds(625, 400, 100, 50);
f.add(b);
}
if (e.getSource() == b4) {
JFrame f = new JFrame("ADMIN LOG IN");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
JLabel l1 = new JLabel("Username :");
l1.setBounds(450, 200, 200, 20);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(550, 200, 200, 20);
f.add(t1);
// try to insert background image in label
ImageIcon image;
try {
image = new ImageIcon(getClass().getResource("C:\\Users\\Ashika\\Desktop"));
JLabel l4 = new JLabel(image);
l4.setBounds(0, 0, 400, 550);
l4.setBackground(Color.CYAN);
f.add(l4);
} catch (Exception e3) {
System.out.println("Image not found..");
}
// LABEL 2
JLabel l2 = new JLabel("Password :");
l2.setBounds(450, 300, 200, 20);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(550, 300, 200, 20);
f.add(t2);
}
if (e.getSource() == b5) {
JFrame f = new JFrame("CUSTOMER SIGN IN");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
Font Font1 = new Font("Times New Roman", Font.BOLD, 15);
// try to insert background image in label
ImageIcon image;
try {
image = new ImageIcon(getClass().getResource("C:\\Users\\Ashika\\Desktop"));
JLabel l4 = new JLabel(image);
l4.setBounds(0, 0, 400, 550);
l4.setBackground(Color.CYAN);
f.add(l4);
} catch (Exception e2) {
System.out.println("Image not found..");
}
JLabel l1 = new JLabel("USERNAME");
l1.setBounds(450, 50, 200, 50);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(605, 50, 150, 50);
f.add(t1);
JLabel l2 = new JLabel("PASSWORD");
l2.setBounds(450, 150, 200, 50);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(600, 150, 150, 50);
f.add(t2);
JLabel l3 = new JLabel("EMAIL");
l3.setBounds(450, 250, 200, 50);
l3.setFont(Font1);
f.add(l3);
JTextField t3 = new JTextField(20);
t3.setBounds(600, 250, 150, 50);
f.add(t3);
JLabel l4 = new JLabel("PHONE NUMBER");
l4.setBounds(450, 350, 200, 50);
l4.setFont(Font1);
f.add(l4);
JTextField t4 = new JTextField(20);
t4.setBounds(600, 350, 150, 50);
f.add(t4);
JButton b = new JButton("SIGN IN");
b.setBounds(650, 450, 100, 50);
f.add(b);
}
if (e.getSource() == b6) {
JFrame f = new JFrame("CUSTOMER LOG IN");
f.setVisible(true);
f.setSize(800, 550);
f.setLayout(null);
JLabel l1 = new JLabel("Username :");
l1.setBounds(450, 200, 200, 20);
l1.setFont(Font1);
f.add(l1);
JTextField t1 = new JTextField(20);
t1.setBounds(550, 200, 200, 20);
f.add(t1);
// try to insert background image in label
ImageIcon image;
try {
image = new ImageIcon(getClass().getResource("C:\\Users\\Ashika\\Desktop"));
JLabel l4 = new JLabel(image);
l4.setBounds(0, 0, 400, 550);
l4.setBackground(Color.CYAN);
f.add(l4);
} catch (Exception e3) {
System.out.println("Image not found..");
}
// LABEL 2
JLabel l2 = new JLabel("Password :");
l2.setBounds(450, 300, 200, 20);
l2.setFont(Font1);
f.add(l2);
JTextField t2 = new JTextField(20);
t2.setBounds(550, 300, 200, 20);
f.add(t2);
}
}
}