-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignup.java
More file actions
244 lines (195 loc) · 8.12 KB
/
Signup.java
File metadata and controls
244 lines (195 loc) · 8.12 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
package Bank.Management.System;
import com.toedter.calendar.JDateChooser;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
public class Signup extends JFrame implements ActionListener {
JRadioButton r1,r2,m1,m2,m3;
JButton next;
JTextField textName, textFname, textEmail, textAdd, textCity, textPin, textState;
JDateChooser dateChooser;
Random ran = new Random();
long first4 = (ran.nextLong() % 9000L) + 1000L;
String first = " " + Math.abs(first4);
Signup(){
super("APPLICATION FORM");
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icon/bank.png"));
Image i2 = i1.getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image = new JLabel(i3);
image.setBounds(25, 10, 100, 100);
add(image);
JLabel label1 = new JLabel("APPLICATION FORM NO." + first);
label1.setBounds(160, 45, 600, 40);
label1.setFont(new Font("Raleway", Font.BOLD, 38));
add(label1);
JLabel label2 = new JLabel("Page 1");
label2.setFont(new Font("Raleway", Font.BOLD, 22));
label2.setBounds(400, 95, 600, 30);
add(label2);
JLabel label3 = new JLabel("Personal Details");
label3.setFont(new Font("Raleway", Font.BOLD, 22));
label3.setBounds(350, 125, 600, 30);
add(label3);
JLabel labelname = new JLabel("Name :");
labelname.setFont(new Font("Raleway", Font.BOLD, 20));
labelname.setBounds(100, 190, 100, 30);
add(labelname);
textName = new JTextField();
textName.setFont(new Font("Raleway", Font.BOLD,14));
textName.setBounds(300,191,400,30);
add(textName);
JLabel labelFname = new JLabel("Father's Name :");
labelFname.setFont(new Font("Raleway", Font.BOLD, 20));
labelFname.setBounds(100, 240, 200, 30);
add(labelFname);
textFname = new JTextField();
textFname.setFont(new Font("Raleway", Font.BOLD,14));
textFname.setBounds(300,241,400,30);
add(textFname);
JLabel DOB = new JLabel("Date of Birth :");
DOB.setFont(new Font("Raleway", Font.BOLD, 20));
DOB.setBounds(100, 340, 200, 30);
add(DOB);
dateChooser = new JDateChooser();
dateChooser.setForeground(new Color(105, 105, 105));
dateChooser.setBounds(300, 341, 400, 30);
add(dateChooser);
JLabel labelG = new JLabel("Gender :");
labelG.setFont(new Font("Raleway", Font.BOLD, 20));
labelG.setBounds(100, 290, 200, 30);
add(labelG);
r1 = new JRadioButton("Male");
r1.setFont(new Font("Raleway", Font.BOLD, 14));
r1.setBackground(new Color(222, 255, 228));
r1.setBounds(300, 291, 60, 30);
add(r1);
r2 = new JRadioButton("Female");
r2.setFont(new Font("Raleway", Font.BOLD, 14));
r2.setBackground(new Color(222, 255, 228));
r2.setBounds(398, 291, 90, 30);
add(r2);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(r1);
buttonGroup.add(r2);
JLabel labelEmail = new JLabel("Email Address :");
labelEmail.setFont(new Font("Raleway", Font.BOLD, 20));
labelEmail.setBounds(100, 390, 290, 30);
add(labelEmail);
textEmail = new JTextField();
textEmail.setFont(new Font("Raleway", Font.BOLD,14));
textEmail.setBounds(300,391,400,30);
add(textEmail);
JLabel labelMs = new JLabel("Married Status :");
labelMs.setFont(new Font("Raleway", Font.BOLD, 20));
labelMs.setBounds(100, 440, 290, 30);
add(labelMs);
m1 = new JRadioButton("Married");
m1.setBounds(300, 441, 100, 30);
m1.setBackground(new Color(222, 255, 228));
m1.setFont(new Font("Raleway", Font.BOLD,14));
add(m1);
m2 = new JRadioButton("Unmarried");
m2.setBounds(398, 441, 100, 30);
m2.setBackground(new Color(222, 255, 228));
m2.setFont(new Font("Raleway", Font.BOLD,14));
add(m2);
m3 = new JRadioButton("Other");
m3.setBounds(510, 441, 100, 30);
m3.setBackground(new Color(222, 255, 228));
m3.setFont(new Font("Raleway", Font.BOLD,14));
add(m3);
ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(m1);
buttonGroup1.add(m2);
buttonGroup1.add(m3);
JLabel labelAdd = new JLabel("Address :");
labelAdd.setFont(new Font("Raleway", Font.BOLD, 20));
labelAdd.setBounds(100, 490, 290, 30);
add(labelAdd);
textAdd = new JTextField();
textAdd.setFont(new Font("Raleway", Font.BOLD,14));
textAdd.setBounds(300,491,400,30);
add(textAdd);
JLabel labelCity = new JLabel("City :");
labelCity.setFont(new Font("Raleway", Font.BOLD, 20));
labelCity.setBounds(100, 540, 290, 30);
add(labelCity);
textCity = new JTextField();
textCity.setFont(new Font("Raleway", Font.BOLD,14));
textCity.setBounds(300,541,400,30);
add(textCity);
JLabel labelPin = new JLabel("Pincode :");
labelPin.setFont(new Font("Raleway", Font.BOLD, 20));
labelPin.setBounds(100, 590, 290, 30);
add(labelPin);
textPin = new JTextField();
textPin.setFont(new Font("Raleway", Font.BOLD,14));
textPin.setBounds(300,591,400,30);
add(textPin);
JLabel labelState = new JLabel("State :");
labelState.setFont(new Font("Raleway", Font.BOLD, 20));
labelState.setBounds(100, 640, 290, 30);
add(labelState);
textState = new JTextField();
textState.setFont(new Font("Raleway", Font.BOLD,14));
textState.setBounds(300,641,400,30);
add(textState);
next = new JButton("Next");
next.setFont(new Font("Raleway", Font.BOLD, 14));
next.setBackground(Color.BLACK);
next.setForeground(Color.white);
next.setBounds(610, 705, 90, 35);
next.addActionListener(this);
add(next);
getContentPane().setBackground(new Color(222, 255, 228));
setLayout(null);
setSize(850, 800);
setLocation(360, 40);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
String formno = first;
String name = textName.getText();
String fname = textFname.getText();
String dob = ((JTextField) dateChooser.getDateEditor().getUiComponent()).getText();
String gender = null;
if (r1.isSelected()){
gender = "Male";
}else if (r2.isSelected()){
gender = "Female";
}
String email = textEmail.getText();
String marital = null;
if (m1.isSelected()){
marital = "Married";
} else if (m2.isSelected()) {
marital = "Unmarried";
} else if (m3.isSelected()){
marital = "Other";
}
String address = textAdd.getText();
String city = textCity.getText();
String pincode = textPin.getText();
String state = textState.getText();
try {
if (textName.getText().equals("")){
JOptionPane.showMessageDialog(null, "Fill all the fields");
} else {
Connections connections1 = new Connections();
String q ="insert into signup values('"+formno+"', '"+name+"', '"+fname+"', '"+dob+"', '"+gender+"', '"+email+"', '"+marital+"', '"+address+"', '"+city+"', '"+pincode+"', '"+state+"')";
connections1.statement.executeUpdate(q);
new Signup2(formno);
setVisible(false);
}
} catch (Exception E){
E.printStackTrace();
}
}
public static void main(String[] args) {
new Signup();
}
}