-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmini.java
More file actions
88 lines (69 loc) · 2.8 KB
/
mini.java
File metadata and controls
88 lines (69 loc) · 2.8 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
package Bank.Management.System;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
public class mini extends JFrame implements ActionListener {
String pin;
JButton button;
mini(String pin){
this.pin = pin;
getContentPane().setBackground(new Color(255,204,204));
setSize(400, 600);
setLocation(20,20);
setLayout(null);
JLabel label1 = new JLabel();
label1.setBounds(20,140,400,220);
add(label1);
JLabel label2 = new JLabel("National Bank");
label2.setFont(new Font("System", Font.BOLD,20));
label2.setBounds(130,20,200,20);
add(label2);
JLabel label3 = new JLabel();
label3.setBounds(20,80,200,20);
add(label3);
JLabel label4 = new JLabel();
label4.setBounds(20,420,200,20);
add(label4);
try {
Connections connections = new Connections();
ResultSet resultSet = connections.statement.executeQuery("select * from login where pin = '"+pin+"' ");
while (resultSet.next()){
label3.setText("Card Number: " + resultSet.getString("card_number").substring(0,4) + "XXXXXXXX" + resultSet.getString("card_number").substring(12));
}
}catch (Exception e){
e.printStackTrace();
}
try {
int balance = 0;
Connections connections = new Connections();
ResultSet resultSet = connections.statement.executeQuery("select * from bank where pin = '"+pin+"' ");
while (resultSet.next()){
label1.setText(label1.getText() + "<html>" + resultSet.getString("date") + " " + resultSet.getString("type") + " " + resultSet.getString("ammount") + "<br><br><html>");
if (resultSet.getString("type").equals("Deposit")){
balance += Integer.parseInt(resultSet.getString("ammount"));
}else {
balance -= Integer.parseInt(resultSet.getString("ammount"));
}
}
label4.setText("Your Total Balance is Rs. " + balance);
}catch (Exception e){
e.printStackTrace();
}
button = new JButton("Exit");
button.setBounds(20,500,100,25);
button.addActionListener(this);
button.setBackground(Color.black);
button.setForeground(Color.white);
add(button);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
public static void main(String[] args) {
new mini("");
}
}