-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathF6.java
337 lines (303 loc) · 15.7 KB
/
F6.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* F6.java
*
* Created on Aug 10, 2017, 10:33:15 AM
*/
package Bank;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Student
*/
public class F6 extends javax.swing.JFrame {
/** Creates new form F6 */
public F6() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
op1 = new javax.swing.JOptionPane();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
ac = new javax.swing.JTextField();
label2 = new java.awt.Label();
back = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
label1 = new java.awt.Label();
op1.setBackground(new java.awt.Color(255, 51, 51));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTable1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 51)));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"A/c No", "Name", "debit ", "date(dr)", " place", "credit", "date(cr)", "place"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
jButton1.setFont(new java.awt.Font("Comic Sans MS", 1, 20)); // NOI18N
jButton1.setForeground(new java.awt.Color(0, 153, 0));
jButton1.setText("Check A/C Detail");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Comic Sans MS", 1, 20)); // NOI18N
jButton2.setForeground(new java.awt.Color(0, 153, 0));
jButton2.setText("Clear A/c data");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setFont(new java.awt.Font("Comic Sans MS", 1, 20)); // NOI18N
jButton3.setForeground(new java.awt.Color(51, 153, 0));
jButton3.setText("UPDATE A/C");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Comic Sans MS", 1, 16)); // NOI18N
jLabel1.setForeground(new java.awt.Color(153, 51, 0));
jLabel1.setText("Enter A/C num");
label2.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
label2.setForeground(new java.awt.Color(255, 0, 0));
label2.setText("Check Transaction for Single Account");
back.setBackground(new java.awt.Color(102, 153, 255));
back.setFont(new java.awt.Font("Tahoma", 1, 22)); // NOI18N
back.setForeground(new java.awt.Color(102, 102, 0));
back.setText("<---");
back.setBorder(null);
back.setFocusCycleRoot(true);
back.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backActionPerformed(evt);
}
});
jButton8.setBackground(new java.awt.Color(153, 153, 255));
jButton8.setFont(new java.awt.Font("Tahoma", 1, 22)); // NOI18N
jButton8.setText("X");
jButton8.setBorder(new javax.swing.border.MatteBorder(null));
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jButton5.setBackground(new java.awt.Color(204, 255, 255));
jButton5.setFont(new java.awt.Font("Californian FB", 1, 14)); // NOI18N
jButton5.setText("Sign Out");
jButton5.setBorder(null);
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
label1.setFont(new java.awt.Font("Century Schoolbook", 1, 60)); // NOI18N
label1.setForeground(new java.awt.Color(51, 51, 255));
label1.setText("Bank Of India");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(201, 201, 201)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(ac, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(jButton1)
.addGap(36, 36, 36)
.addComponent(jButton2)
.addGap(33, 33, 33)
.addComponent(jButton3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(61, 61, 61)))
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5))))
.addGroup(layout.createSequentialGroup()
.addGap(163, 163, 163)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 593, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(ac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(19, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
@SuppressWarnings("static-access")
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String acn=ac.getText();
DefaultTableModel model= (DefaultTableModel)
jTable1.getModel();
try{
Class.forName("java.sql.DriverManager");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bankofind","root","root");
Statement stmt= (Statement) con.createStatement();
String query="Select *from bankdata where Acc_no='"+acn+"';";
ResultSet rs=stmt.executeQuery(query);
if(rs.next()){
try{
Class.forName("java.sql.DriverManager");
Connection con1 = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bankofind","root","root");
Statement stmt1= (Statement) con1.createStatement();
String query1="Select*from bankdataac where Acc_no='"+acn+"';";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next()){
String Acc_no=rs.getString("Acc_no");
String Name=rs.getString("Name");
String Debit=rs.getString("Debit");
String Debitdate=rs.getString("Debitdate");
String Dplace=rs.getString("DPlace");
String Credit=rs.getString("credit");
String Creditdate=rs.getString("creditdate");
String Cplace=rs.getString("CPlace");
model.addRow (new Object[] {Acc_no,Name,Debit,Debitdate,Dplace,Credit,Creditdate,Cplace});
}
}
catch(Exception e)
{
op1.showMessageDialog(this,e.getMessage());
}
}
else{
op1.showMessageDialog(null,"No Such Accno");
}
}
catch(Exception e)
{
op1.showMessageDialog(this,e.getMessage());
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
DefaultTableModel model=(DefaultTableModel)
jTable1.getModel();
int rows=model.getRowCount();
if(rows>0){
{
for(int i=0; i<rows;i++)
model.removeRow(0);
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
F8 x=new F8();
x.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton3ActionPerformed
private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed
// TODO add your handling code here:
F4 r= new F4();
r.setVisible(true);
this.dispose();
}//GEN-LAST:event_backActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// TODO add your handling code here:
System.exit(0);
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
F1_Login f=new F1_Login();
f.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton5ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new F6().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField ac;
private javax.swing.JButton back;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton8;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private java.awt.Label label1;
private java.awt.Label label2;
private javax.swing.JOptionPane op1;
// End of variables declaration//GEN-END:variables
}