-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignupTwo.java
More file actions
273 lines (229 loc) · 10.7 KB
/
Copy pathSignupTwo.java
File metadata and controls
273 lines (229 loc) · 10.7 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SignupTwo extends JFrame implements ActionListener {
JComboBox<String> religionComboBox, categoryComboBox, incomeComboBox, educationComboBox, occupationComboBox;
JTextField adharTextField = new JTextField();
JTextField panTextField = new JTextField();
JButton nextBtn, backBtn;
JRadioButton seniorYesRadioBtn, seniorNoRadioBtn, ExistingYes, ExistingNo;
SignupTwo() {
// Setting Frame Properties
setTitle("Account Opening Form - Page 02");
setSize(850, 780);
setLocation(350, 50);
setVisible(true);
setLayout(null);
getContentPane().setBackground(Color.WHITE);
// Additional details Label
JLabel additionalDetails = new JLabel("Page 2: Additional details");
additionalDetails.setFont(new Font("Raleway", Font.BOLD, 22));
additionalDetails.setBounds(290, 80, 400, 30);
add(additionalDetails);
// Religion Label
JLabel religionLabel = new JLabel("Religion:");
religionLabel.setFont(new Font("Raleway", Font.BOLD, 20));
religionLabel.setBounds(100, 140, 100, 30);
add(religionLabel);
// Religion Combo Box
String[] religions = { "Hindu", "Muslim", "Christian", "Sikh", "Others" };
religionComboBox = new JComboBox<>(religions);
religionComboBox.setFont(new Font("Raleway", Font.BOLD, 14));
religionComboBox.setBounds(300, 140, 400, 30);
religionComboBox.setSelectedIndex(-1); // Set to null by default
add(religionComboBox);
// Category Label
JLabel categoryLabel = new JLabel("Category:");
categoryLabel.setFont(new Font("Raleway", Font.BOLD, 20));
categoryLabel.setBounds(100, 190, 200, 30);
add(categoryLabel);
// Category Combo Box
String[] categories = { "GENERAL", "OBC", "SC", "ST", "Others" };
categoryComboBox = new JComboBox<>(categories);
categoryComboBox.setFont(new Font("Raleway", Font.BOLD, 14));
categoryComboBox.setBounds(300, 190, 400, 30);
categoryComboBox.setSelectedIndex(-1); // Set to null by default
add(categoryComboBox);
// Senior Citizen Label
JLabel seniorLabel = new JLabel("Senior citizen:");
seniorLabel.setFont(new Font("Raleway", Font.BOLD, 20));
seniorLabel.setBounds(100, 240, 200, 30);
add(seniorLabel);
// Senior Citizen Radio Button
// Yes Button
seniorYesRadioBtn = new JRadioButton("Yes");
seniorYesRadioBtn.setFont(new Font("Raleway", Font.BOLD, 15));
seniorYesRadioBtn.setBackground(Color.WHITE);
seniorYesRadioBtn.setBounds(300, 230, 90, 50);
add(seniorYesRadioBtn);
// No Button
seniorNoRadioBtn = new JRadioButton("No");
seniorNoRadioBtn.setFont(new Font("Raleway", Font.BOLD, 15));
seniorNoRadioBtn.setBackground(Color.WHITE);
seniorNoRadioBtn.setBounds(450, 230, 90, 50);
add(seniorNoRadioBtn);
// Grouping Senior Citizen Radio button to same class
ButtonGroup seniorRadioGroup = new ButtonGroup();
seniorRadioGroup.add(seniorYesRadioBtn);
seniorRadioGroup.add(seniorNoRadioBtn);
// Income Label
JLabel incomeLabel = new JLabel("Income:");
incomeLabel.setFont(new Font("Raleway", Font.BOLD, 20));
incomeLabel.setBounds(100, 290, 200, 30);
add(incomeLabel);
// Income Combo Box
String[] incomes = { "<100000", "100001 - 249999", "250000 - 499999", "500000 - 999999", ">1000000" };
incomeComboBox = new JComboBox<>(incomes);
incomeComboBox.setFont(new Font("Raleway", Font.BOLD, 14));
incomeComboBox.setBounds(300, 290, 400, 30);
incomeComboBox.setSelectedIndex(-1); // Set to null by default
add(incomeComboBox);
// Exixting Account Label
JLabel existingAccountLabel = new JLabel("Existing Account:");
existingAccountLabel.setFont(new Font("Raleway", Font.BOLD, 20));
existingAccountLabel.setBounds(100, 340, 200, 30);
add(existingAccountLabel);
// Existing Account Radio Button
// Yes Button
ExistingYes = new JRadioButton("Yes");
ExistingYes.setFont(new Font("Raleway", Font.BOLD, 15));
ExistingYes.setBackground(Color.WHITE);
ExistingYes.setBounds(300, 330, 100, 50);
add(ExistingYes);
// No Button
ExistingNo = new JRadioButton("No");
ExistingNo.setFont(new Font("Raleway", Font.BOLD, 15));
ExistingNo.setBackground(Color.WHITE);
ExistingNo.setBounds(450, 330, 120, 50);
add(ExistingNo);
// Grouping Existing account Radio Button to same class
ButtonGroup maritalGroupBtn = new ButtonGroup();
maritalGroupBtn.add(ExistingYes);
maritalGroupBtn.add(ExistingNo);
// Educational Qualification Label
JLabel educationLabel = new JLabel("Education:");
educationLabel.setFont(new Font("Raleway", Font.BOLD, 20));
educationLabel.setBounds(100, 390, 200, 30);
add(educationLabel);
// Address Text field
String[] education = { "Matriculated", "Intermediate", "Graduate", "Post Graduate", "Doctorate", "Others" };
educationComboBox = new JComboBox<>(education);
educationComboBox.setFont(new Font("Raleway", Font.BOLD, 14));
educationComboBox.setBounds(300, 390, 400, 30);
educationComboBox.setSelectedIndex(-1); // Set to null by default
add(educationComboBox);
// Occupation Label
JLabel occupationLabel = new JLabel("Occupation:");
occupationLabel.setFont(new Font("Raleway", Font.BOLD, 20));
occupationLabel.setBounds(100, 440, 200, 30);
add(occupationLabel);
// Occupation Combo Box
String occupation[] = { "Engineer", "Doctor", "Artist", "Self-Employed", "Others" };
occupationComboBox = new JComboBox<>(occupation);
occupationComboBox.setFont(new Font("Raleway", Font.BOLD, 14));
occupationComboBox.setBounds(300, 440, 400, 30);
occupationComboBox.setSelectedIndex(-1); // Set to null by default
add(occupationComboBox);
// Pan card Label
JLabel panLabel = new JLabel("Pan no.:");
panLabel.setFont(new Font("Raleway", Font.BOLD, 20));
panLabel.setBounds(100, 490, 200, 30);
add(panLabel);
// Pan card Text field
panTextField.setFont(new Font("Raleway", Font.BOLD, 14));
panTextField.setBounds(300, 490, 400, 30);
add(panTextField);
// Adhar Label
JLabel adharLabel = new JLabel("Adhar no.:");
adharLabel.setFont(new Font("Raleway", Font.BOLD, 20));
adharLabel.setBounds(100, 540, 200, 30);
add(adharLabel);
// Adhar card Text field
adharTextField.setFont(new Font("Raleway", Font.BOLD, 14));
adharTextField.setBounds(300, 540, 400, 30);
add(adharTextField);
// Back Button
backBtn = new JButton("Back");
backBtn.setFont(new Font("Raleway", Font.BOLD, 15));
backBtn.setBackground(Color.BLACK);
backBtn.setForeground(Color.WHITE);
backBtn.setBounds(330, 620, 80, 40);
backBtn.addActionListener(this);
add(backBtn);
// Next Button
nextBtn = new JButton("Next");
nextBtn.setFont(new Font("Raleway", Font.BOLD, 15));
nextBtn.setBackground(Color.BLACK);
nextBtn.setForeground(Color.WHITE);
nextBtn.setBounds(500, 620, 80, 40);
nextBtn.addActionListener(this);
add(nextBtn);
}
@Override
public void actionPerformed(ActionEvent ae) {
String religion = "";
religion = (String) religionComboBox.getSelectedItem();
String seniorValue = "";
if (seniorYesRadioBtn.isSelected()) {
seniorValue = "Yes";
} else if (seniorNoRadioBtn.isSelected()) {
seniorValue = "No";
}
String existingValue = "";
if (ExistingYes.isSelected()) {
existingValue = "Yes";
} else if (ExistingNo.isSelected()) {
existingValue = "No";
}
String category = "";
category = (String) categoryComboBox.getSelectedItem();
String income = "";
income = (String) incomeComboBox.getSelectedItem();
String education = "";
education = (String) educationComboBox.getSelectedItem();
String occupation = "";
occupation = (String) occupationComboBox.getSelectedItem();
String pan = "";
pan = panTextField.getText();
String adhar = "";
adhar = adharTextField.getText();
try {
if (ae.getSource() == backBtn) {
this.dispose();
SignupOne signupone = new SignupOne();
signupone.setVisible(true);
} else if (ae.getSource() == nextBtn) {
if (religion == null || religion.equals("")) {
JOptionPane.showMessageDialog(null, "Please select your Religion");
} else if (category == null || category.equals("")) {
JOptionPane.showMessageDialog(null, "Please select your Category");
} else if (seniorValue.equals("")) {
JOptionPane.showMessageDialog(null, "Please select whether you are a Senior Citizen");
} else if (income == null || income.equals("")) {
JOptionPane.showMessageDialog(null, "Please select your Annual Income Range");
} else if (existingValue.equals("")) {
JOptionPane.showMessageDialog(null, "Please select whether you have an Existing Account with us");
} else if (education == null || education.equals("")) {
JOptionPane.showMessageDialog(null, "Please select your Latest Education Degree");
} else if (occupation == null || occupation.equals("")) {
JOptionPane.showMessageDialog(null, "Please select your Occupation");
} else if (pan == null || pan.equals("")) {
JOptionPane.showMessageDialog(null, "Please enter your PAN Number");
} else if (adhar == null || adhar.equals("")) {
JOptionPane.showMessageDialog(null, "Please enter your AADHAR Number");
} else {
// Code from Below
SignupThree signupThreeObj = new SignupThree();
signupThreeObj.setVisible(true);
this.dispose();
}
}
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) {
new SignupTwo();
}
}