-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththird_atm.java
More file actions
executable file
·176 lines (123 loc) · 3.69 KB
/
Copy paththird_atm.java
File metadata and controls
executable file
·176 lines (123 loc) · 3.69 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
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
/**
* @(#)third_atm.java
*
*
* @author
*
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class third_atm extends JFrame implements ActionListener{
public static void main(String[]args){
third_atm panel = new third_atm();
panel.setSize(330,300);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(400,250);
}
JButton btnBals = new JButton("Bal.Inquiry");
JButton btnDep = new JButton("Deposit");
JButton btnWid = new JButton("Withdraw");
JButton btntrans = new JButton("Transfer");
JButton btnLogOut = new JButton(new ImageIcon("logout.jpg"));
Connection cn;
Statement st;
PreparedStatement ps;
public third_atm() {
super("ATM");
JPanel pane = new JPanel();
pane.setLayout(null);
btnBals.setBounds(15,60,100,25);
pane.add(btnBals);
btnBals.addActionListener(this);
btnBals.setForeground(Color.yellow);
btnBals.setBackground(Color.black);
btntrans.setBounds(15,120,100,25);
pane.add(btntrans);
btntrans.addActionListener(this);
btntrans.setForeground(Color.yellow);
btntrans.setBackground(Color.black);
btnDep.setBounds(210,60,100,25);
pane.add(btnDep);
btnDep.addActionListener(this);
btnDep.setForeground(Color.yellow);
btnDep.setBackground(Color.black);
btnWid.setBounds(210,120,100,25);
pane.add(btnWid);
btnWid.addActionListener(this);
btnWid.setForeground(Color.yellow);
btnWid.setBackground(Color.black);
btnLogOut.setBounds(125,190,80,25);
pane.add(btnLogOut);
btnLogOut.addActionListener(this);
JLabel lbl = new JLabel(new ImageIcon("back.jpg"));
lbl.setBounds(0,0,330,300);
pane.add(lbl);
setContentPane(pane);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
pane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Select Transaction"));
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn = DriverManager.getConnection("jdbc:odbc:project");
}catch(ClassNotFoundException e) {
System.err.println("Failed to load driver");
e.printStackTrace();
}
catch(SQLException e){
System.err.println("Unable to connect");
e.printStackTrace();
}
}
public void actionPerformed(ActionEvent e){
Object source = e.getSource();
if(source == btnBals){
Bal_trans log=new Bal_trans();
log.setLocation(400,250);
log.setSize(250,200);
log.setTitle("Balance Inquiry");
log.setResizable(false);
log.setVisible(true);
dispose();
}
if(source == btnDep){
dep_trans log=new dep_trans();
log.setLocation(400,250);
log.setSize(250,200);
log.setResizable(false);
log.setVisible(true);
dispose();
}
if(source == btnWid){
WDraw_trans log=new WDraw_trans();
log.setLocation(400,250);
log.setSize(250,200);
log.setResizable(false);
log.setVisible(true);
dispose();
}
if(source == btntrans){
transfer_trans log=new transfer_trans();
log.setLocation(400,250);
log.setSize(500,250);
log.setResizable(false);
log.setVisible(true);
dispose();
}
if(source == btnLogOut){
int n=JOptionPane.showConfirmDialog(null,"Are you sure you want to exit?","Exit",JOptionPane.YES_NO_OPTION);
if(n==JOptionPane.YES_OPTION){
// JOptionPane.showMessageDialog(null,"Good Bye","ATM",JOptionPane.INFORMATION_MESSAGE);
// System.exit(0);
first_atm log=new first_atm();
log.setLocation(400,250);
log.setSize(250,150);
log.setTitle("Log-In");
log.setResizable(false);
log.setVisible(true);
dispose();
}
}
}
}