📄 assexit.java
字号:
/*
* Assexit.java
*
* Created on 2007年11月17日, 下午6:24
*/
package javaapplication1;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author mis05
*/
public class Assexit extends javax.swing.JPanel {
/** Creates new form Assexit */
public Assexit() {
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(126, 126, 126)
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 125, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(149, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(125, 125, 125)
.add(jButton1)
.addContainerGap(152, 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 + -