-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignupTwo.java
More file actions
193 lines (156 loc) · 6.67 KB
/
Copy pathSignupTwo.java
File metadata and controls
193 lines (156 loc) · 6.67 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class SignupTwo extends JFrame implements ActionListener {
String formNo;
JComboBox<String> religionBox, categoryBox, incomeBox, educationBox, occupationBox;
JTextField panField, aadharField;
JRadioButton seniorYes, seniorNo, existingYes, existingNo;
JButton next;
public SignupTwo(String formNo) {
this.formNo = formNo;
setTitle("NEW ACCOUNT APPLICATION - PAGE 2");
setLayout(null);
JLabel formNo2 = new JLabel("APPLICATION FORM NO. " + formNo);
formNo2.setFont(new Font("Raleway", Font.BOLD, 30));
formNo2.setBounds(180, 20, 600, 40);
add(formNo2);
JLabel applicationDetails = new JLabel("Page 2: Additional Details");
applicationDetails.setFont(new Font("Raleway", Font.BOLD, 22));
applicationDetails.setBounds(290, 70, 400, 30);
add(applicationDetails);
// Religion
JLabel religion = new JLabel("Religion:");
religion.setFont(new Font("Raleway", Font.PLAIN, 18));
religion.setBounds(100, 120, 150, 30);
add(religion);
String[] religions = {"Hindu", "Muslim", "Sikh", "Christian", "Other"};
religionBox = new JComboBox<>(religions);
religionBox.setBounds(300, 120, 400, 30);
add(religionBox);
// Category
JLabel category = new JLabel("Category:");
category.setFont(new Font("Raleway", Font.PLAIN, 18));
category.setBounds(100, 170, 150, 30);
add(category);
String[] categories = {"General", "OBC", "SC", "ST", "Other"};
categoryBox = new JComboBox<>(categories);
categoryBox.setBounds(300, 170, 400, 30);
add(categoryBox);
// Income
JLabel income = new JLabel("Income:");
income.setFont(new Font("Raleway", Font.PLAIN, 18));
income.setBounds(100, 220, 150, 30);
add(income);
String[] incomes = {"<1,50,000", "<2,50,000", "<5,00,000", ">5,00,000"};
incomeBox = new JComboBox<>(incomes);
incomeBox.setBounds(300, 220, 400, 30);
add(incomeBox);
// Education
JLabel education = new JLabel("Educational Qualification:");
education.setFont(new Font("Raleway", Font.PLAIN, 18));
education.setBounds(100, 270, 200, 30);
add(education);
String[] educations = {"Non-Graduate", "Graduate", "Post-Graduate", "Doctorate", "Other"};
educationBox = new JComboBox<>(educations);
educationBox.setBounds(300, 270, 400, 30);
add(educationBox);
// Occupation
JLabel occupation = new JLabel("Occupation:");
occupation.setFont(new Font("Raleway", Font.PLAIN, 18));
occupation.setBounds(100, 320, 150, 30);
add(occupation);
String[] occupations = {"Salaried", "Self-Employed", "Business", "Student", "Retired", "Other"};
occupationBox = new JComboBox<>(occupations);
occupationBox.setBounds(300, 320, 400, 30);
add(occupationBox);
// PAN
JLabel pan = new JLabel("PAN Number:");
pan.setFont(new Font("Raleway", Font.PLAIN, 18));
pan.setBounds(100, 370, 150, 30);
add(pan);
panField = new JTextField();
panField.setBounds(300, 370, 400, 30);
add(panField);
// Aadhar
JLabel aadhar = new JLabel("Aadhar Number:");
aadhar.setFont(new Font("Raleway", Font.PLAIN, 18));
aadhar.setBounds(100, 420, 150, 30);
add(aadhar);
aadharField = new JTextField();
aadharField.setBounds(300, 420, 400, 30);
add(aadharField);
// Senior Citizen
JLabel senior = new JLabel("Senior Citizen:");
senior.setFont(new Font("Raleway", Font.PLAIN, 18));
senior.setBounds(100, 470, 150, 30);
add(senior);
seniorYes = new JRadioButton("Yes");
seniorYes.setBounds(300, 470, 100, 30);
seniorYes.setBackground(Color.WHITE);
add(seniorYes);
seniorNo = new JRadioButton("No");
seniorNo.setBounds(450, 470, 100, 30);
seniorNo.setBackground(Color.WHITE);
add(seniorNo);
ButtonGroup seniorGroup = new ButtonGroup();
seniorGroup.add(seniorYes);
seniorGroup.add(seniorNo);
// Existing Account
JLabel existing = new JLabel("Existing Account:");
existing.setFont(new Font("Raleway", Font.PLAIN, 18));
existing.setBounds(100, 520, 150, 30);
add(existing);
existingYes = new JRadioButton("Yes");
existingYes.setBounds(300, 520, 100, 30);
existingYes.setBackground(Color.WHITE);
add(existingYes);
existingNo = new JRadioButton("No");
existingNo.setBounds(450, 520, 100, 30);
existingNo.setBackground(Color.WHITE);
add(existingNo);
ButtonGroup existingGroup = new ButtonGroup();
existingGroup.add(existingYes);
existingGroup.add(existingNo);
// Next Button
next = new JButton("Next");
next.setBounds(620, 600, 80, 30);
next.addActionListener(this);
add(next);
getContentPane().setBackground(Color.WHITE);
setSize(850, 720);
setLocation(350, 10);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String religion = religionBox.getSelectedItem().toString();
String category = categoryBox.getSelectedItem().toString();
String income = incomeBox.getSelectedItem().toString();
String education = educationBox.getSelectedItem().toString();
String occupation = occupationBox.getSelectedItem().toString();
String pan = panField.getText();
String aadhar = aadharField.getText();
String senior = seniorYes.isSelected() ? "Yes" : "No";
String existing = existingYes.isSelected() ? "Yes" : "No";
if (pan.equals("") || aadhar.equals("")) {
JOptionPane.showMessageDialog(null, "Please fill all required fields");
} else {
try {
Conn c = new Conn();
String query = "INSERT INTO signuptwo VALUES('" + formNo + "','" + religion + "','" + category + "','" + income + "','" + education + "','" + occupation + "','" + pan + "','" + aadhar + "','" + senior + "','" + existing + "')";
c.s.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Page 2 Submitted Successfully");
// ✅ Redirect to SignupThree with formNo
setVisible(false);
new SignupThree(formNo);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
// Optional for standalone test
public static void main(String[] args) {
new SignupTwo("9999"); // Test form number
}
}