-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignup.java
249 lines (202 loc) · 8.22 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
package bankmanagement;
import javax.swing.*;
//import com.toedter.calendar.JDateChooser;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.sql.SQLException;
import java.lang.String;
import com.toedter.calendar.JDateChooser;
import static java.awt.Color.green;
public class Signup extends JFrame implements ActionListener {
JRadioButton r1,r2,m1,m2,m3;
JButton next;
JTextField textName ,textFname, textEmail,textAdd,textcity,textState,textPin;
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("iconn/bank.png"));
java.awt.Image i2 = i1.getImage().getScaledInstance(100,100,java.awt.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,20,600,40);
label1.setFont(new Font("Raleway",Font.BOLD,38));
add(label1);
JLabel label2 = new JLabel("Page 1");
label2.setFont(new Font("Ralway",Font.BOLD, 22));
label2.setBounds(330,70,600,30);
add(label2);
JLabel label3 = new JLabel("Personal Details");
label3.setFont(new Font("Raleway", Font.BOLD,22));
label3.setBounds(290,90,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,190,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,240,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,340,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(255, 165, 0));
r1.setBounds(300,290,60,30);
add(r1);
r2 = new JRadioButton("Female");
r2.setBackground(new Color(255, 165, 0));
r2.setFont(new Font("Raleway", Font.BOLD,14));
r2.setBounds(450,290,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,200,30);
add(labelEmail);
textEmail = new JTextField();
textEmail.setFont(new Font("Raleway",Font.BOLD, 14));
textEmail.setBounds(300,390,400,30);
add(textEmail);
JLabel labelMs = new JLabel("Marital Status :");
labelMs.setFont(new Font("Raleway", Font.BOLD, 20));
labelMs.setBounds(100,440,200,30);
add(labelMs);
m1 = new JRadioButton("Married");
m1.setBounds(300,440,100,30);
m1.setBackground(new Color(255, 165, 0));
m1.setFont(new Font("Raleway", Font.BOLD,14));
add(m1);
m2 = new JRadioButton("Single");
m2.setBackground(new Color(255, 165, 0));
m2.setBounds(450,440,100,30);
m2.setFont(new Font("Raleway", Font.BOLD,14));
add(m2);
m3 = new JRadioButton("Other");
m3.setBackground(new Color(255, 165, 0));
m3.setBounds(635,440,100,30);
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,200,30);
add(labelAdd);
textAdd = new JTextField();
textAdd.setFont(new Font("Raleway",Font.BOLD, 14));
textAdd.setBounds(300,490,400,30);
add(textAdd);
JLabel labelCity = new JLabel("City :");
labelCity.setFont(new Font("Raleway", Font.BOLD, 20));
labelCity.setBounds(100,540,200,30);
add(labelCity);
textcity = new JTextField();
textcity.setFont(new Font("Raleway",Font.BOLD, 14));
textcity.setBounds(300,540,400,30);
add(textcity);
JLabel labelPin = new JLabel("Pin Code :");
labelPin.setFont(new Font("Raleway", Font.BOLD, 20));
labelPin.setBounds(100,590,200,30);
add(labelPin);
textPin = new JTextField();
textPin.setFont(new Font("Raleway",Font.BOLD, 14));
textPin.setBounds(300,590,400,30);
add(textPin);
JLabel labelstate = new JLabel("State :");
labelstate.setFont(new Font("Raleway", Font.BOLD, 20));
labelstate.setBounds(100,640,200,30);
add( labelstate);
textState = new JTextField();
textState.setFont(new Font("Raleway",Font.BOLD, 14));
textState.setBounds(300,640,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(620,710,80,30);
next.addActionListener(this);
add(next);
getContentPane().setBackground(new Color(255,165,0));
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("")){
javax.swing.JOptionPane.showMessageDialog(null, "Fill all the fields");
}else {
connn c = new connn();
String q = "insert into signup values('"+formno+"', '"+name+"','"+fname+"','"+dob+"','"+gender+"','"+email+"','"+marital+"', '"+address+"', '"+city+"','"+pincode+"','"+state+"' )";
c.statement.executeUpdate(q);
new Signup2(formno);
setVisible(false);
}
}catch (Exception E){
E.printStackTrace();
}
}
public static void main(String[] args) {
new Signup();
}
}