-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignup3.java
266 lines (224 loc) · 8.75 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
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package bankmanagement;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
/**
*
* @author cotad
*/
public class Signup3 extends JFrame implements ActionListener {
JRadioButton r1,r2,r3,r4;
JCheckBox c1,c2,c3,c4,c5,c6;
JButton s,c;
String formno;
Signup3(String formno){
this.formno = formno;
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("iconn/bank.png"));
Image i2 = i1.getImage().getScaledInstance(100,100,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image = new JLabel(i3);
image.setBounds(150,5,100,100);
add(image);
JLabel l1 = new JLabel("Page 3:");
l1.setFont(new Font("Raleway",Font.BOLD,22));
l1.setBounds(280,40,400,40);
add(l1);
JLabel l2 = new JLabel("Account Details");
l2.setFont(new Font("Raleway",Font.BOLD,22));
l2.setBounds(280,70,400,40);
add(l2);
JLabel l3 = new JLabel("Account Type:");
l3.setFont(new Font("Raleway",Font.BOLD,18));
l3.setBounds(100,140,200,30);
add(l3);
r1 = new JRadioButton("Saving Account");
r1.setFont(new Font("Raleway",Font.BOLD,16));
r1.setBackground(new Color(215,252,252));
r1.setBounds(100,180,150,30);
add(r1);
r2 = new JRadioButton("Fixed Deposit Account");
r2.setFont(new Font("Raleway",Font.BOLD,16));
r2.setBackground(new Color(215,252,252));
r2.setBounds(350,180,300,30);
add(r2);
r3 = new JRadioButton("Current Account");
r3.setFont(new Font("Raleway",Font.BOLD,16));
r3.setBackground(new Color(215,252,252));
r3.setBounds(100,220,250,30);
add(r3);
r4 = new JRadioButton("Recurring Deposit Account");
r4.setFont(new Font("Raleway",Font.BOLD,16));
r4.setBackground(new Color(215,252,252));
r4.setBounds(350,220,250,30);
add(r4);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(r1);
buttonGroup.add(r2);
buttonGroup.add(r3);
buttonGroup.add(r4);
JLabel l4 = new JLabel("Card Number:");
l4.setFont(new Font("Raleway",Font.BOLD,18));
l4.setBounds(100,300,200,30);
add(l4);
JLabel l5 = new JLabel("(Your 16-digit Card Number)");
l5.setFont(new Font("Raleway",Font.BOLD,12));
l5.setBounds(100,330,200,20);
add(l5);
JLabel l6 = new JLabel("XXXX-XXXX-XXXX-4841");
l6.setFont(new Font("Raleway",Font.BOLD,18));
l6.setBounds(330,300,250,30);
add(l6);
JLabel l7 = new JLabel("(It would appear on atm card/cheque Book and Statements)");
l7.setFont(new Font("Raleway",Font.BOLD,12));
l7.setBounds(330,330,500,20);
add(l7);
JLabel l8 = new JLabel("PIN:");
l8.setFont(new Font("Raleway",Font.BOLD,18));
l8.setBounds(100,370,200,30);
add(l8);
JLabel l9 = new JLabel("XXXX");
l9.setFont(new Font("Raleway",Font.BOLD,18));
l9.setBounds(330,370,200,30);
add(l9);
JLabel l10 = new JLabel("(4-digit Password)");
l10.setFont(new Font("Raleway",Font.BOLD,12));
l10.setBounds(100,400,200,20);
add(l10);
JLabel l11 = new JLabel("Services Required:");
l11.setFont(new Font("Raleway",Font.BOLD,18));
l11.setBounds(100,450,200,30);
add(l11);
c1 = new JCheckBox("ATM CARD");
c1.setBackground(new Color(215,252,252));
c1.setFont(new Font("Raleway",Font.BOLD,16));
c1.setBounds(100,500,200,30);
add(c1);
c2 = new JCheckBox("Internet Banking");
c2.setBackground(new Color(215,252,252));
c2.setFont(new Font("Raleway",Font.BOLD,16));
c2.setBounds(350,500,200,30);
add(c2);
c3 = new JCheckBox("Mobile Banking");
c3.setBackground(new Color(215,252,252));
c3.setFont(new Font("Raleway",Font.BOLD,16));
c3.setBounds(100,550,200,30);
add(c3);
c4 = new JCheckBox("EMAIL Alerts");
c4.setBackground(new Color(215,252,252));
c4.setFont(new Font("Raleway",Font.BOLD,16));
c4.setBounds(350,550,200,30);
add(c4);
c5 = new JCheckBox("Cheque Book");
c5.setBackground(new Color(215,252,252));
c5.setFont(new Font("Raleway",Font.BOLD,16));
c5.setBounds(100,600,200,30);
add(c5);
c6 = new JCheckBox("E-Statement");
c6.setBackground(new Color(215,252,252));
c6.setFont(new Font("Raleway",Font.BOLD,16));
c6.setBounds(350,600,200,30);
add(c6);
JCheckBox c7 = new JCheckBox("I here by decleares that the above entered details correct to the best of my knlowledge.",true);
c7.setBackground(new Color(215,252,252));
c7.setFont(new Font("Raleway",Font.BOLD,12));
c7.setBounds(100,680,600,20);
add(c7);
JLabel l12 = new JLabel("Form No : ");
l12.setFont(new Font("Raleway", Font.BOLD,14));
l12.setBounds(700,10,100,30);
add(l12);
JLabel l13 = new JLabel(formno);
l13.setFont(new Font("Raleway", Font.BOLD,14));
l13.setBounds(760,10,60,30);
add(l13);
s = new JButton("Submit");
s.setFont(new Font("Raleway", Font.BOLD,14));
s.setBackground(Color.BLACK);
s.setForeground(Color.WHITE);
s.setBounds(250,720,100,30);
s.addActionListener(this);
add(s);
c = new JButton("Cancel");
c.setFont(new Font("Raleway", Font.BOLD,14));
c.setBackground(Color.BLACK);
c.setForeground(Color.WHITE);
c.setBounds(420,720,100,30);
c.addActionListener(this);
add(c);
getContentPane().setBackground(new Color(215,252,252));
setSize(850,800);
setLayout(null);
setLocation(400,20);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
String atype = null;
if (r1.isSelected()){
atype = "Saving Account";
} else if (r2.isSelected()) {
atype ="Fixed Deposit Account";
}else if (r3.isSelected()){
atype ="Current Account";
}else if (r4.isSelected()){
atype = "Recurring Deposit Account";
}
Random ran = new Random();
long first7 = (ran.nextLong() % 900000000000L) +140000000000L ;
String cardno = "" + Math.abs(first7);
long first3 = (ran.nextLong() % 9000L)+ 14000L;
String pin = "" + Math.abs(first3);
String fac = "";
if(c1.isSelected()){
fac = fac+"ATM CARD ";
} else if (c2.isSelected()) {
fac = fac+"Internet Banking";
} else if (c3.isSelected()) {
fac = fac+"Mobile Banking";
} else if (c4.isSelected()) {
fac = fac+"EMAIL Alerts";
} else if (c5.isSelected()) {
fac=fac+"Cheque Book";
} else if (c6.isSelected()) {
fac=fac+"E-Statement";
}
try {
if (e.getSource()==s){
if (atype.equals("")){
JOptionPane.showMessageDialog(null,"Fill all the fields");
}else {
connn c1 = new connn();
String q1 = "insert into signupthree values('"+formno+"', '"+atype+"','"+cardno+"','"+pin+"','"+fac+"')";
String q2 = "insert into loginn values('"+formno+"','"+cardno+"','"+pin+"')";
c1.statement.executeUpdate(q1);
c1.statement.executeUpdate(q2);
JOptionPane.showMessageDialog(null,"Card Number : "+cardno+"\n Pin : "+pin );
new Deposit(pin);
setVisible(false);
}
} else if (e.getSource()==c) {
System.exit(0);
}
}catch (Exception E){
E.printStackTrace();
}
}
public static void main(String[] args) {
new Signup3("");
}
}