-
Notifications
You must be signed in to change notification settings - Fork 0
/
F9.java
241 lines (214 loc) · 11.2 KB
/
F9.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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* F9.java
*
* Created on 15 Aug, 2017, 3:34:34 PM
*/
package Bank;
import java.sql.*;
import java.sql.DriverManager;
/**
*
* @author iayushag
*/
public class F9 extends javax.swing.JFrame {
/** Creates new form F9 */
public F9() {
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();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
label2 = new java.awt.Label();
acn = new javax.swing.JTextField();
nm = new javax.swing.JTextField();
DELETETHERECORD = new javax.swing.JButton();
label1 = new java.awt.Label();
back = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
jLabel1.setForeground(new java.awt.Color(51, 102, 0));
jLabel1.setText("Enter A/C Num");
jLabel2.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(51, 102, 0));
jLabel2.setText("Enter Name");
label2.setFont(new java.awt.Font("Comic Sans MS", 0, 16)); // NOI18N
label2.setForeground(new java.awt.Color(0, 153, 0));
label2.setText("DELETE A RECORD OF A CUSTOMER");
DELETETHERECORD.setFont(new java.awt.Font("Comic Sans MS", 1, 20)); // NOI18N
DELETETHERECORD.setForeground(new java.awt.Color(0, 102, 51));
DELETETHERECORD.setText("DELETE THE RECORD");
DELETETHERECORD.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
DELETETHERECORD.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DELETETHERECORDActionPerformed(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");
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);
}
});
jButton9.setBackground(new java.awt.Color(153, 153, 255));
jButton9.setFont(new java.awt.Font("Tahoma", 1, 22)); // NOI18N
jButton9.setText("X");
jButton9.setBorder(new javax.swing.border.MatteBorder(null));
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton6.setBackground(new java.awt.Color(204, 255, 255));
jButton6.setFont(new java.awt.Font("Californian FB", 1, 14)); // NOI18N
jButton6.setText("Sign Out");
jButton6.setBorder(null);
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
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.createSequentialGroup()
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 526, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6)))
.addGroup(layout.createSequentialGroup()
.addGap(146, 146, 146)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(180, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(121, 121, 121)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(acn)
.addComponent(nm, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE))
.addGap(157, 157, 157))
.addGroup(layout.createSequentialGroup()
.addGap(206, 206, 206)
.addComponent(DELETETHERECORD, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(179, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.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(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(acn, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(nm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(42, 42, 42)
.addComponent(DELETETHERECORD)
.addContainerGap(26, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
@SuppressWarnings("static-access")
private void DELETETHERECORDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DELETETHERECORDActionPerformed
// TODO add your handling code here:
String name=nm.getText();
String ac=acn.getText();
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="DELETE FROM bankdata WHERE Acc_no='"+ac+"' and name='"+name+"';";
stmt.executeUpdate(query);
nm.setText("");
acn.setText("");
op1.showMessageDialog(null,"Record deleted");
}
catch(Exception e)
{
op1.showMessageDialog(this,e.getMessage());
}
}//GEN-LAST:event_DELETETHERECORDActionPerformed
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 jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
// TODO add your handling code here:
System.exit(0);
}//GEN-LAST:event_jButton9ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
F1_Login f=new F1_Login();
f.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton6ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new F9().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton DELETETHERECORD;
private javax.swing.JTextField acn;
private javax.swing.JButton back;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private java.awt.Label label1;
private java.awt.Label label2;
private javax.swing.JTextField nm;
private javax.swing.JOptionPane op1;
// End of variables declaration//GEN-END:variables
}