-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTranscations.java
195 lines (128 loc) · 5.32 KB
/
Transcations.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.myprojects.bankingsystemmanagement;
/**
*
* @author admin
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Transcations extends JFrame implements ActionListener{
JLabel l1;
JButton b1,b2,b3,b4,b5,b6,b7;
Transcations(){
setFont(new Font("System", Font.BOLD, 22));
Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("TRANSACTION");
int y = fm.stringWidth(" ");
int z = getWidth() - (3*x);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"TRANSACTION");
l1 = new JLabel("Please Select Your Transaction");
l1.setFont(new Font("System", Font.BOLD, 38));
b1 = new JButton("DEPOSIT");
b1.setFont(new Font("System", Font.BOLD, 18));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
b2 = new JButton("CASH WITHDRAWL");
b2.setFont(new Font("System", Font.BOLD, 18));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
b3 = new JButton("FAST CASH");
b3.setFont(new Font("System", Font.BOLD, 18));
b3.setBackground(Color.BLACK);
b3.setForeground(Color.WHITE);
b4 = new JButton("MINI STATEMENT");
b4.setFont(new Font("System", Font.BOLD, 18));
b4.setBackground(Color.BLACK);
b4.setForeground(Color.WHITE);
b5 = new JButton("PIN CHANGE");
b5.setFont(new Font("System", Font.BOLD, 18));
b5.setBackground(Color.BLACK);
b5.setForeground(Color.WHITE);
b6 = new JButton("BALANCE ENQUIRY");
b6.setFont(new Font("System", Font.BOLD, 18));
b6.setBackground(Color.BLACK);
b6.setForeground(Color.WHITE);
b7 = new JButton("EXIT");
b7.setFont(new Font("System", Font.BOLD, 18));
b7.setBackground(Color.BLACK);
b7.setForeground(Color.WHITE);
setLayout(null);
l1.setBounds(100,100,700,40);
add(l1);
b1.setBounds(40,250,300,60);
add(b1);
b2.setBounds(440,250,300,60);
add(b2);
b3.setBounds(40,360,300,60);
add(b3);
b4.setBounds(440,360,300,60);
add(b4);
b5.setBounds(40,470,300,60);
add(b5);
b6.setBounds(440,470,300,60);
add(b6);
b7.setBounds(240,600,300,60);
add(b7);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
getContentPane().setBackground(Color.WHITE);
setSize(800,800);
setLocation(500,90);
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
if(ae.getSource()==b1){
new Deposit().setVisible(true);
setVisible(false);
}
else if(ae.getSource()==b2){
new Withdrawl().setVisible(true);
setVisible(false);
}
else if(ae.getSource()==b3){
new FastCash().setVisible(true);
setVisible(false);
}else if(ae.getSource()==b4){
new Login().setVisible(true);
setVisible(false);
}else if(ae.getSource()==b5){
new Pin().setVisible(true);
setVisible(false);
}else if(ae.getSource()==b6){
String pinn = JOptionPane.showInputDialog("Enter PIN");
JdbcConnection c1 = new JdbcConnection();
try {
ResultSet rs = c1.s.executeQuery(" SELECT balance FROM bank ORDER BY pin = '"+pinn+"' DESC LIMIT 1");
if(rs.next()){
String balance = rs.getString("balance");
JOptionPane.showMessageDialog(null,"Your Account Balance is "+balance);
}
} catch (Exception e) {
e.printStackTrace();
}
}else if(ae.getSource()==b7){
System.exit(0);
}
}
public static void main(String[] args){
new Transcations().setVisible(true);
}
}