Repository navigation
Expand file tree
/
Copy pathBalanceEnquriy.java
More file actions
75 lines (63 loc) · 2.23 KB
/
Copy pathBalanceEnquriy.java
File metadata and controls
75 lines (63 loc) · 2.23 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
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 BalanceEnquriy extends JFrame implements ActionListener {
String pin_number;
JLabel label2;
JButton b1;
BalanceEnquriy(String pin_number){
this.pin_number =pin_number;
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icon/atm2.png"));
Image i2 = i1.getImage().getScaledInstance(1550,830,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel l3 = new JLabel(i3);
l3.setBounds(0,0,1550,830);
add(l3);
JLabel label1 = new JLabel("Your Current Balance is Rs ");
label1.setForeground(Color.WHITE);
label1.setFont(new Font("System", Font.BOLD, 16));
label1.setBounds(430,180,700,35);
l3.add(label1);
label2 = new JLabel();
label2.setForeground(Color.WHITE);
label2.setFont(new Font("System", Font.BOLD, 16));
label2.setBounds(430,220,400,35);
l3.add(label2);
b1 = new JButton("Back");
b1.setBounds(700,406,150,35);
b1.setBackground(new Color(65,125,128));
b1.setForeground(Color.WHITE);
b1.addActionListener(this);
l3.add(b1);
int balance =0;
try{
Connn c = new Connn();
ResultSet resultSet = c.statement.executeQuery("Select * from bank where pin_number = '"+pin_number+"'");
while (resultSet.next()){
if (resultSet.getString("type").equals("Deposit")){
balance += Integer.parseInt(resultSet.getString("amount"));
}else {
balance -= Integer.parseInt(resultSet.getString("amount"));
}
}
}catch (Exception e){
e.printStackTrace();
}
label2.setText(""+balance);
setLayout(null);
setSize(1550,1080);
setLocation(0,0);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
new main_Class(pin_number);
}
public static void main(String[] args) {
new BalanceEnquriy("");
}
}