?? teacherexit.java
字號:
/*
* Teacherexit.java
*
* Created on 2007年11月17日, 下午5:53
*/
package javaapplication1;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author mis05
*/
public class Teacherexit extends javax.swing.JPanel {
/** Creates new form Teacherexit */
public Teacherexit() {
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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton1.setText("\u9000\u51fa\u6b64\u7cfb\u7edf");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exit(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(121, 121, 121)
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 133, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(146, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(132, 132, 132)
.add(jButton1)
.addContainerGap(145, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void exit(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit
Statement sql;
try{
Conect conect = new Conect();
sql = conect.dbConn.createStatement();
int reg;
reg = sql.executeUpdate("UPDATE 學生 SET 登錄 = 0 WHERE 登錄 = 1");
System.exit(1);
}
catch(SQLException sqlException){
JOptionPane.showMessageDialog(null,sqlException.getMessage(),"Database Error",JOptionPane.ERROR_MESSAGE);
System.exit(1);}
catch(ClassNotFoundException classNotFound){
JOptionPane.showMessageDialog(null,classNotFound.getMessage(),"Driver Not Found",JOptionPane.ERROR_MESSAGE);
System.exit(1); }// TODO add your handling code here:
}//GEN-LAST:event_exit
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
// End of variables declaration//GEN-END:variables
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -