-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMini.java
More file actions
79 lines (69 loc) · 2.64 KB
/
Copy pathMini.java
File metadata and controls
79 lines (69 loc) · 2.64 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
import javax.swing.*;
import java.awt.*;
import java.sql.ResultSet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Mini extends JFrame implements ActionListener {
String pin;
JButton b1;
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,250);
label1.setVerticalAlignment(SwingConstants.TOP);
add(label1);
JLabel label2 = new JLabel("Siya Saxena");
label2.setFont(new Font("System",Font.BOLD,15));
label2.setBounds(150,20,200,20);
add(label2);
JLabel label3 = new JLabel();
label3.setBounds(20,80,300,20);
add(label3);
JLabel label4 = new JLabel();
label4.setBounds(20,400,300,20);
add(label4);
try{
Con c = new Con();
ResultSet resultSet = c.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;
Con c = new Con();
ResultSet resultSet = c.statement.executeQuery("select * from bank where pin = '"+pin+"'");
while(resultSet.next()){
label1.setText(label1.getText() + "<html>" + resultSet.getString("date")+" " + resultSet.getString("type")+" " + resultSet.getString("amount")+"<br><br><html>"+ " ");
if(resultSet.getString("type").equals("Deposit")){
balance += Integer.parseInt(resultSet.getString("amount"));
}else{
balance -= Integer.parseInt(resultSet.getString("amount"));
}
}
label4.setText("Your Total Balance is Rs " + balance);
}catch(Exception E){
E.printStackTrace();
}
b1 = new JButton("EXIT");
b1.setBounds(20,500,100,25);
b1.addActionListener(this);
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
add(b1);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e){
setVisible(false);
}
public static void main(String args[]){
new Mini("");
}
}