📄 assinformation.java
字号:
/*
* Assinformation.java
*
* Created on 2007年11月17日, 下午6:48
*/
package javaapplication1;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author mis05
*/
public class Assinformation extends javax.swing.JPanel {
/** Creates new form Assinformation */
public Assinformation() {
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();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1.setText("\u67e5\u8be2\u7ba1\u7406\u5458\u4fe1\u606f");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
search(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
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(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(78, 78, 78)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 249, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.add(140, 140, 140)
.add(jButton1)))
.addContainerGap(73, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(46, Short.MAX_VALUE)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(18, 18, 18)
.add(jButton1)
.add(60, 60, 60))
);
}// </editor-fold>//GEN-END:initComponents
private void search(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_search
Statement sql;
try{
Conect conect = new Conect();
sql = conect.dbConn.createStatement();
String number = null;
int temp = 0;
ResultSet rs = sql.executeQuery("select 教务管理员编号 from 教务管理员 where 登录 =1");
while( rs.next() ) {
number = rs.getObject(1).toString();
}
String query = "select 教务管理员编号,姓名,学院名称,政治面貌,职称 from 教务管理员,学院 where 教务管理员编号 ='"+number+"' and 教务管理员.所属学院编号=学院.学院编号";
rs = sql.executeQuery(query);
StringBuffer output = new StringBuffer();
ResultSetMetaData data = rs.getMetaData();
int columns = data.getColumnCount();
rs.next();
output.append( "教务管理员编号\t" + rs.getObject(1) + "\n");
output.append("姓名\t"+rs.getObject(2)+"\n");
output.append("学院名称\t"+rs.getObject(3)+"\n");
output.append("政治面貌\t"+rs.getObject(4)+"\n");
output.append("职称\t"+rs.getObject(5)+"\n");
String output1 = output.toString();
jTextArea1.setText( output1 );
}
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_search
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -