-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignup.java
318 lines (241 loc) · 8.71 KB
/
Signup.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
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
package ASimulationSystem;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
public class Signup extends JFrame implements ActionListener {
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9, l10,l11,l12,l13,l14,l15;
JTextField t1,t2,t3,t4,t5,t6,t7;
JRadioButton r1,r2,r3,r4,r5;
JButton b;
JComboBox c1 , c2, c3;
String day[] = new String[31];
String month[] = new String[12];
String year[] = new String[26];
// JDateChooser dateChooser;
Random ran = new Random();
long first4 = (ran.nextLong() % 9000L ) + 1000L;
String first = "" + Math.abs(first4);
Signup(){
setTitle("NEW ACCOUNT APPLICATION FORM");
//
// ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("ASimulation/src/logo.jpg"));
// Image i2 = i1.getImage().getScaledInstance(100,100,Image.SCALE_DEFAULT);
// ImageIcon i3 = new ImageIcon(i2);
// JLabel l11 = new JLabel(i3);
// l11.setBounds(70,10,100,100);
// add(l11);
l1 = new JLabel("Application Form No: "+first);
l1.setFont( new Font("Raleway", Font.BOLD, 38));
l1.setBounds(140,20,550,40);
add(l1);
l2 = new JLabel("Page 1: Personal Details ");
l2.setFont( new Font("Raleway", Font.BOLD, 22));
l2.setBounds(290,80,550,30);
add(l2);
l3 = new JLabel("Name: ");
l3.setFont( new Font("Raleway", Font.BOLD, 20));
l3.setBounds(100,140,100,30);
add(l3);
t1 = new JTextField();
t1.setBounds(300,140,400,30);
t1.setFont( new Font("Raleway", Font.BOLD, 14));
add(t1);
l4 = new JLabel("Father's Name: ");
l4.setFont( new Font("Raleway", Font.BOLD, 20));
l4.setBounds(100,190,200,30);
add(l4);
t2 = new JTextField();
t2.setBounds(300,190,400,30);
t2.setFont( new Font("Raleway", Font.BOLD, 14));
add(t2);
l5 = new JLabel("Date Of Birth: ");
l5.setFont( new Font("Raleway", Font.BOLD, 20));
l5.setBounds(100,240,200,30);
add(l5);
// gender start
l6 = new JLabel("Gender: ");
l6.setFont( new Font("Raleway", Font.BOLD, 20));
l6.setBounds(100,290,200,30);
add(l6);
r1 = new JRadioButton("Male");
r1.setFont( new Font("Raleway", Font.BOLD, 18));
r1.setBackground(Color.white);
r1.setBounds(299,290,200,30);
add(r1);
r2 = new JRadioButton("Female");
r2.setFont( new Font("Raleway", Font.BOLD, 18));
r2.setBackground(Color.white);
r2.setBounds(600,290,200,30);
add(r2);
ButtonGroup groupGender = new ButtonGroup();
groupGender.add(r1);
groupGender.add(r2);
// gender end
// email start
l7 = new JLabel("Email Address: ");
l7.setFont( new Font("Raleway", Font.BOLD, 18));
l7.setBounds(100,340,200,30);
add(l7);
t3 = new JTextField();
t3.setFont( new Font("Raleway", Font.BOLD, 14));
t3.setBounds(300, 340, 400, 30);
add(t3);
// email end
// martial start
l8 = new JLabel("Marital Status: ");
l8.setFont( new Font("Raleway", Font.BOLD, 18));
l8.setBounds(100,390,200, 30);
add(l8);
r3 = new JRadioButton("Married");
r3.setFont( new Font("Raleway", Font.BOLD, 18));
r3.setBackground(Color.white);
r3.setBounds(299,390,200,30);
add(r3);
r4 = new JRadioButton("Unmarried");
r4.setFont( new Font("Raleway", Font.BOLD, 18));
r4.setBackground(Color.white);
r4.setBounds(420,390,200,30);
add(r4);
r5 = new JRadioButton("Other");
r5.setFont( new Font("Raleway", Font.BOLD, 18));
r5.setBackground(Color.white);
r5.setBounds(600,390,200,30);
add(r5);
ButtonGroup groupstatus = new ButtonGroup();
groupstatus.add(r3);
groupstatus.add(r4);
groupstatus.add(r4);
// end marital
// start address
l9 = new JLabel("Address: ");
l9.setFont( new Font("Raleway", Font.BOLD, 18));
l9.setBounds(100, 440, 200, 30);
add(l9);
t4 = new JTextField();
t4.setFont( new Font("Raleway", Font.BOLD, 14));
t4.setBounds(300, 440, 400, 30);
add(t4);
//city
l10 = new JLabel("City: ");
l10.setFont( new Font("Raleway", Font.BOLD, 18));
l10.setBounds(100, 490, 200, 30);
add(l10);
t5 = new JTextField();
t5.setFont( new Font("Raleway", Font.BOLD, 14));
t5.setBounds(300, 490, 400, 30);
add(t5);
// pin code
l11 = new JLabel("Pin Code: ");
l11.setFont( new Font("Raleway", Font.BOLD, 18));
l11.setBounds(100, 540, 200, 30);
add(l11);
t6 = new JTextField();
t6.setFont( new Font("Raleway", Font.BOLD, 14));
t6.setBounds(300, 540, 400, 30);
add(t6);
// state
l12 = new JLabel("State : ");
l12.setFont( new Font("Raleway", Font.BOLD, 18));
l12.setBounds(100, 590, 200, 30);
add(l12);
t7 = new JTextField();
t7.setFont( new Font("Raleway", Font.BOLD, 14));
t7.setBounds(300, 590, 400, 30);
add(t7);
// date of births
for (int i = 1; i < 31; i++) {
day[i-1] = String.valueOf(i);
}
c1 = new JComboBox(day);
c1.setBounds(335,240, 60,30);
add(c1);
l13 = new JLabel("Day");
l13.setFont( new Font("Raleway", Font.BOLD, 17));
l13.setBounds(300, 235, 70, 40);
add(l13);
for (int i = 1; i < 12; i++) {
month[i-1] = String.valueOf(i);
}
c2 = new JComboBox(month);
c2.setBounds(490,240, 60,30);
add(c2);
l14 = new JLabel("Month");
l14.setFont( new Font("Raleway", Font.BOLD, 17));
l14.setBounds(435, 235, 70, 40);
add(l14);
for (int i = 1990; i < 2015; i++) {
year[i-1990] = String.valueOf(i);
}
c3 = new JComboBox(year);
c3.setBounds(638,240, 60,30);
add(c3);
l15 = new JLabel("Year");
l15.setFont( new Font("Raleway", Font.BOLD, 17));
l15.setBounds(600, 235, 70, 40);
add(l15);
// Button
b = new JButton("Next");
b.setFont( new Font("Raleway", Font.BOLD, 17));
b.setBackground(Color.black);
b.setForeground(Color.white);
b.setBounds(620,660,80,30);
add(b);
b.addActionListener(this);
setLayout(null);
getContentPane().setBackground(Color.white);
setBounds(300, 30, 830,790);
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
//String formno = first;
String a = t1.getText();
String b = t2.getText();
String ac = (String)c1.getSelectedItem();
String bc = (String)c2.getSelectedItem();
String cc = (String)c3.getSelectedItem();
String d = null;
if(r1.isSelected()){
d = "Male";
}else if(r2.isSelected()){
d = "Female";
}
String e = t3.getText();
String f = null;
if(r3.isSelected()){
f = "Married";
}
else if(r4.isSelected()){
f = "Unmarried";
}
else
{
f = "Other";
}
String g = t4.getText();
String h = t5.getText();
String i = t6.getText();
String j = t7.getText();
try{
if(t6.getText().equals("")){
JOptionPane.showMessageDialog(null,"Fill all the required fields");
}
else{
Conn c1 = new Conn();
String q1 = "insert into signup values('"+a+"','"+b+"',"
+ "'"+ac+"','"+bc+"','"+cc+"','"+d+"','"+e+"','"+f+"'"
+ ",'"+g+"','"+h+"''"+i+"','"+j+"')";
c1.s.executeUpdate(q1);
new Signup2().setVisible(true);
setVisible(false);
}
}catch(Exception ex){
ex.printStackTrace();
}
}
public static void main(String[] args) {
Signup s = new Signup();
s.setVisible(true);
}
}