⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhufang1.java

📁 毕业设计_物业管理系统
💻 JAVA
字号:
/* * zhufang.java * * Created on 2001年5月31日, 下午8:51 */package zc.face;import java.sql.*;import java.io.*;/** * * @author  Administrator * @version  */public class zhufang1 extends javax.swing.JFrame {    /** Creates new form zhufang */    public zhufang1() {        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();        jLabel1 = new javax.swing.JLabel();        jPanel2 = new javax.swing.JPanel();        jLabel2 = new javax.swing.JLabel();        jTextField1 = new javax.swing.JTextField();        jPanel3 = new javax.swing.JPanel();        jButton1 = new javax.swing.JButton();        jButton3 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        setTitle("\u4f4f\u623f\u4fe1\u606f\u67e5\u8be2\u754c\u97621");        addWindowListener(new java.awt.event.WindowAdapter() {            public void windowClosing(java.awt.event.WindowEvent evt) {                exitForm(evt);            }        }        );                jPanel1.setLayout(new java.awt.BorderLayout());                jLabel1.setText("\u8bf7\u8f93\u5165\u4e0b\u5217\u5185\u5bb9\u8fdb\u884c\u67e5\u8be2");          jPanel1.add(jLabel1, java.awt.BorderLayout.NORTH);                            jPanel2.setLayout(new java.awt.GridBagLayout());          java.awt.GridBagConstraints gridBagConstraints1;                    jLabel2.setText("\u59d3\u540d:");            gridBagConstraints1 = new java.awt.GridBagConstraints();            gridBagConstraints1.gridx = 0;            gridBagConstraints1.gridy = 3;            jPanel2.add(jLabel2, gridBagConstraints1);                                  jTextField1.setColumns(10);            gridBagConstraints1 = new java.awt.GridBagConstraints();            gridBagConstraints1.gridx = 5;            gridBagConstraints1.gridy = 3;            jPanel2.add(jTextField1, gridBagConstraints1);                        jPanel1.add(jPanel2, java.awt.BorderLayout.CENTER);                            getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);                                jButton1.setActionCommand("\u67e5\u8be2");          jButton1.setText("\u67e5\u8be2");          jButton1.addActionListener(new java.awt.event.ActionListener() {              public void actionPerformed(java.awt.event.ActionEvent evt) {                  jButton1ActionPerformed(evt);              }          }          );          jPanel3.add(jButton1);                            jButton3.setText("\u7ee7\u7eed\u67e5\u8be2");          jButton3.addActionListener(new java.awt.event.ActionListener() {              public void actionPerformed(java.awt.event.ActionEvent evt) {                  jButton3ActionPerformed(evt);              }          }          );          jPanel3.add(jButton3);                            jButton2.setText("\u53d6\u6d88");          jButton2.addActionListener(new java.awt.event.ActionListener() {              public void actionPerformed(java.awt.event.ActionEvent evt) {                  jButton2ActionPerformed(evt);              }          }          );          jPanel3.add(jButton2);                            getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);            }//GEN-END:initComponents  private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed      jTextField1.setText(" ");      // Add your handling code here:  }//GEN-LAST:event_jButton3ActionPerformed  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed              try{                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");                        }              catch(ClassNotFoundException ce){                    System.out.println("SQLException:"+ce.getMessage());              }                         try            {                              if(!jTextField1.getText( ).equals(" "))              {                     Connection con=DriverManager.getConnection("jdbc:odbc:houqin");                  System.out.println("链接成功");                  System.out.println("sql查询:");                  String query="select * from zhufang"+  " where  姓名='"+jTextField1.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());             }                        }//GEN-LAST:event_jButton1ActionPerformed  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed      zc.face.userInterface2 jf1=new zc.face.userInterface2();      jf1.setVisible(true);      setVisible(false);      // Add your handling code here:  }//GEN-LAST:event_jButton2ActionPerformed    /** 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 zhufang1 ().show ();    }    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JPanel jPanel1;    private javax.swing.JLabel jLabel1;    private javax.swing.JPanel jPanel2;    private javax.swing.JLabel jLabel2;    private javax.swing.JTextField jTextField1;    private javax.swing.JPanel jPanel3;    private javax.swing.JButton jButton1;    private javax.swing.JButton jButton3;    private javax.swing.JButton jButton2;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -