-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSignup3.java
220 lines (206 loc) · 7.85 KB
/
Signup3.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
package bank.management.system;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//import java.sql.*;
import java.util.*;
public class Signup3 extends JFrame implements ActionListener{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11;
JRadioButton r1,r2,r3,r4;
JButton b1,b2;
JCheckBox c1,c2,c3,c4,c5,c6,c7;
JTextField t1;
Signup3(){
setFont(new Font("System",Font.BOLD,22));
Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("NEW ACCOUNT APPLICATION FORM - PAGE 3");
int y = fm.stringWidth(" ");
int z = getWidth()/2 - (x/2);
int w = z/y;
String pad ="";
pad = String.format("%"+w+"s",pad);
setTitle(pad+"NEW ACCOUNT APPLICATION FORM - PAGE 3");
l1 = new JLabel("Page 3: Accounts Details");
l1.setFont(new Font("Raleway",Font.BOLD,22));
l2 = new JLabel("Account Type");
l2.setFont(new Font("Raleway",Font.BOLD,18));
l3 = new JLabel("Card Number");
l3.setFont(new Font("Raleway",Font.BOLD,18));
l4 = new JLabel("XXXX-XXXX-XXXX-4184");
l4.setFont(new Font("Raleway",Font.BOLD,18));
l5 = new JLabel("Your 16-digit Card Number");
l5.setFont(new Font("Raleway",Font.BOLD,18));
l6 = new JLabel("It would appear on ATM card/Cheque Book and Statements");
l6.setFont(new Font("Raleway",Font.BOLD,18));
l7 = new JLabel("PIN");
l7.setFont(new Font("Raleway",Font.BOLD,18));
l8 = new JLabel("XXXX");
l8.setFont(new Font("Raleway",Font.BOLD,18));
l9 = new JLabel("(4-Digit password)");
l9.setFont(new Font("Raleway",Font.BOLD,18));
l10 = new JLabel("Services Required");
l10.setFont(new Font("Raleway",Font.BOLD,18));
l11 = new JLabel("Form No");
l11.setFont(new Font("Raleway",Font.BOLD,18));
//Buttons
b1 = new JButton("Submit");
b1.setFont(new Font("Raleway",Font.BOLD,14));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
b2 = new JButton("Cancel");
b2.setFont(new Font("Raleway",Font.BOLD,14));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
//CheckBoxes
c1 = new JCheckBox("ATM CARD");
c1.setBackground(Color.WHITE);
c1.setFont(new Font("Raleway",Font.BOLD,16));
c2 = new JCheckBox("Internet Banking");
c2.setBackground(Color.WHITE);
c2.setFont(new Font("Raleway",Font.BOLD,16));
c3 = new JCheckBox("Mobile Banking");
c3.setBackground(Color.WHITE);
c3.setFont(new Font("Raleway",Font.BOLD,16));
c4 = new JCheckBox("Email Alerts");
c4.setBackground(Color.WHITE);
c4.setFont(new Font("Raleway",Font.BOLD,16));
c5 = new JCheckBox("Cheque Book");
c5.setBackground(Color.WHITE);
c5.setFont(new Font("Raleway",Font.BOLD,16));
c6 = new JCheckBox("E-Statement");
c6.setBackground(Color.WHITE);
c6.setFont(new Font("Raleway",Font.BOLD,16));
c7 = new JCheckBox("I hereby declares that the above entered correct to the best of my knowledge.",true);
c7.setBackground(Color.WHITE);
c7.setFont(new Font("Raleway",Font.BOLD,12));
r1 = new JRadioButton("Saving Account");
r1.setFont(new Font("Raleway",Font.BOLD,16));
r1.setBackground(Color.WHITE);
r2 = new JRadioButton("Fixed Deposit Account");
r2.setFont(new Font("Raleway",Font.BOLD,16));
r2.setBackground(Color.WHITE);
r3 = new JRadioButton("Current Account");
r3.setFont(new Font("Raleway",Font.BOLD,16));
r3.setBackground(Color.WHITE);
r4 = new JRadioButton("Recurring Deposit Account");
r4.setFont(new Font("Raleway",Font.BOLD,16));
r4.setBackground(Color.WHITE);
setLayout(null);
//Location
t1.setBounds(770,10,40,30);
add(t1);
l1.setBounds(280,50,400,40);
add(l1);
l2.setBounds(100,140,200,30);
add(l2);
l3.setBounds(100,300,200,30);
add(l3);
l4.setBounds(330,300,250,30);
add(l4);
l5.setBounds(100,330,200,20);
add(l5);
l6.setBounds(330,330,500,20);
add(l6);
l7.setBounds(100,370,200,30);
add(l7);
l8.setBounds(330,370,200,30);
add(l8);
l9.setBounds(100,400,200,20);
add(l9);
l10.setBounds(100,500,200,30);
add(l10);
l11.setBounds(700,10,70,30);
add(l11);
r1.setBounds(100,180,150,30);
add(r1);
r2.setBounds(350,180,300,30);
add(r2);
r3.setBounds(100,220,250,30);
add(t1);
r4.setBounds(350,220,250,30);
add(r4);
c1.setBounds(100,500,200,30);
add(c1);
c2.setBounds(350,500,200,30);
add(c2);
c3.setBounds(100,550,200,30);
add(c3);
c4.setBounds(350,550,200,30);
add(c4);
c5.setBounds(100,600,200,30);
add(c5);
c6.setBounds(350,600,200,30);
add(c6);
c7.setBounds(100,500,200,30);
add(c7);
b1.setBounds(300,720,100,30);
add(b1);
b2.setBounds(420,720,100,30);
add(b2);
getContentPane().setBackground(Color.WHITE);
setSize(850,850);
setLocation(500,90);
setVisible(true);
b1.addActionListener(this);
b2.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent ae){
String a = null;
if(r1.isSelected()){
a = "Saving Account";
}else if(r2.isSelected()){
a = "Fixed Deposit Account";
}else if(r3.isSelected()){
a = "Current Account";
}else if(r4.isSelected()){
a = "Recurring Depost Account";
}
Random ran = new Random();
//For CARd NO
long first7 = (ran.nextLong() %90000000L) + 5040936000000000L;//From Here Card No will be Generated
long first8 = Math.abs(first7);//absolute function because Number will be Negative
//For PIN
long first3 = (ran.nextLong()%9000L) + 1000L;//For Generated Pin
long first4 = Math.abs(first3);
String b = "";
if(c1.isSelected()){
b = b+ "ATM card";
} if(c2.isSelected()){
b = b+ "Internet Banking";
} if(c3.isSelected()){
b = b+ "Mobile Banking";
} if(c4.isSelected()){
b = b+ "Email Alerts";
}if(c5.isSelected()){
b = b+ "Cheque Book";
} if(c6.isSelected()){
a = "E-Statement";
}
String c = t1.getText();
try{
if(ae.getSource()==b1){
if(b.equals("")){
JOptionPane.showMessageDialog(null, "Fill all the Required fields");
}else{
conn c1= new conn();
String q1 = "insert into signup3 values('"+a+"','"+first8+"','"+first4+"','"+b+"','"+c+"')";
String q2 = "insert into signup3 values('"+first8+"','"+first4+"')";
c1.s.executeUpdate(q1);
c1.s.executeUpdate(q2);
JOptionPane.showMessageDialog(null,"Card Number: "+ first8 + "\n Pin:"+first4);
new Deposit().setVisible(true);
setVisible(false);
}
}else if(ae.getSource()==b2){
System.exit(0);
}
}catch(Exception ex){
ex.printStackTrace();
}
}
public static void main(String[] args){
new Signup3().setVisible(true);
}
}