📄 shoufei.java
字号:
/* * shoufei.java * * Created on 2001年5月31日, 下午9:15 */package zc.face;import java.sql.*;import java.io.*;/** * * @author Administrator * @version */public class shoufei extends javax.swing.JFrame { /** Creates new form shoufei */ public shoufei() { initComponents (); pack (); } /** 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 FormEditor. */ private void initComponents() {//GEN-BEGIN:initComponents jPanel1 = new javax.swing.JPanel(); jButton3 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); setTitle("\u6536\u8d39\u4fe1\u606f\u67e5\u8be2\u754c\u9762"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } } ); jButton3.setText("\u67e5\u8be2"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } } ); jPanel1.add(jButton3); jButton1.setText("\u7ee7\u7eed\u67e5\u8be2"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } } ); jPanel1.add(jButton1); jButton4.setText("\u53d6\u6d88"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } } ); jPanel1.add(jButton4); getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH); jPanel3.setLayout(new java.awt.BorderLayout()); jLabel4.setText("\u8bf7\u8f93\u5165\u4e0b\u5217\u5185\u5bb9\u8fdb\u884c\u67e5\u8be2"); jPanel3.add(jLabel4, java.awt.BorderLayout.NORTH); jPanel4.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints1; jLabel5.setText("\u95e8\u724c\u53f7:"); gridBagConstraints1 = new java.awt.GridBagConstraints(); jPanel4.add(jLabel5, gridBagConstraints1); jTextField4.setColumns(10); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } } ); gridBagConstraints1 = new java.awt.GridBagConstraints(); jPanel4.add(jTextField4, gridBagConstraints1); jPanel3.add(jPanel4, java.awt.BorderLayout.CENTER); getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER); }//GEN-END:initComponents private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed// Add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed jTextField4.setText(""); // Add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ System.out.println("SQLException:"+ce.getMessage()); } try { if(!jTextField4.getText( ).equals(" ")) { Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); System.out.println("链接成功"); System.out.println("sql查询:"); String query="select * from shoufei"+ " where 门牌号='"+jTextField4.getText( )+ "' "; System.out.println(query); //进行数据库查询 Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); System.out.println(zc.face.MySqlUnit.printResultSet(rs)); //System.out.println("查询成功"); stmt.close(); con.close(); } else System.out.println("请输入正确的门牌号后按确定按钮"); } catch(SQLException e){ System.out.println("SQLException:"+e.getMessage()); } catch(IOException e2){ System.out.println("IOException:"+e2.getMessage()); } // Add your handling code here: }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed zc.face.userInterface2 jf1=new zc.face.userInterface2(); jf1.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jButton4ActionPerformed /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit (0); }//GEN-LAST:event_exitForm /** * @param args the command line arguments */ public static void main (String args[]) { new shoufei ().show (); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel jPanel1; private javax.swing.JButton jButton3; private javax.swing.JButton jButton1; private javax.swing.JButton jButton4; private javax.swing.JPanel jPanel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel4; private javax.swing.JLabel jLabel5; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -