📄 userinterface2.java
字号:
}//GEN-LAST:event_jMenuItem12ActionPerformed private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed zc.face.renyuan3 jf=new zc.face.renyuan3( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem11ActionPerformed private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed zc.face.renyuan2 jf=new zc.face.renyuan2( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem3ActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed zc.face.renyuan1 jf=new zc.face.renyuan1( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem1ActionPerformed private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed zc.face.zhufang1 jf=new zc.face.zhufang1( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem6ActionPerformed private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed zc.face.fangchan jf=new zc.face.fangchan( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem10ActionPerformed private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed zc.face.shoufei jf=new zc.face.shoufei( ); jf.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem8ActionPerformed private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ System.out.println("SQLException:"+ce.getMessage()); } try{ String query=JOptionPane.showInputDialog("请输入SQL语句 如 select * from fangchan"); if(query.length()==0) query="select * from fangchan"; Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); System.out.println("链接成功\n"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); // System.out.println(zc.face.MySqlUnit.printMetaData(rs)); System.out.println("SQL语句:"+query+"\n"); System.out.println(zc.face.MySqlUnit.printResultSet(rs)); stmt.close(); con.close(); } 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_jMenuItem9ActionPerformed private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed// Add your handling code here: }//GEN-LAST:event_jMenu6ActionPerformed private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed //进行数据库查询 try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ System.out.println("SQLException:"+ce.getMessage()); } try{ String query=JOptionPane.showInputDialog("请输入SQL语句 如 select * from shoufei"); if(query.length()==0) query="select * from shoufei"; Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); System.out.println("链接成功\n"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); // System.out.println(zc.face.MySqlUnit.printMetaData(rs)); System.out.println("SQL语句:"+query+"\n"); System.out.println(zc.face.MySqlUnit.printResultSet(rs)); stmt.close(); con.close(); } catch(SQLException e){ System.out.println("SQLException:"+e.getMessage()); } catch(IOException e2){ System.out.println("IOException:"+e2.getMessage()); } }//GEN-LAST:event_jMenuItem7ActionPerformed private void jMenu5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu5ActionPerformed// Add your handling code here: }//GEN-LAST:event_jMenu5ActionPerformed private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed// Add your handling code here: }//GEN-LAST:event_jMenu4ActionPerformed private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed //进行数据库查询 try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ System.out.println("SQLException:"+ce.getMessage()); } try{ String query =JOptionPane.showInputDialog( "请输入SQL语句 如 select * from zhufang"); if(query.length()==0) query="select * from zhufang"; Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); System.out.println("链接成功\n"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); System.out.println("SQL语句:"+query+"\n"); // System.out.println(zc.face.MySqlUnit.printMetaData(rs)); System.out.println(zc.face.MySqlUnit.printResultSet(rs)); stmt.close(); con.close(); } 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_jMenuItem5ActionPerformed private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed// Add your handling code here: }//GEN-LAST:event_jMenu1ActionPerformed private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ ce.printStackTrace( ); jTextArea1.append("\n"+ce.toString( )+"\n"); } try{ Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); jTextArea1.setText("链接成功\n"); String query=JOptionPane.showInputDialog( "请输入SQL语句 如 select * from renyuan"); if(query.length( )==0) query="select * from renyuan"; Statement stmt=con.createStatement( ); ResultSet rs=stmt.executeQuery(query); jTextArea1.setText("SQL语句:"+query+"\n"); while(rs.next( )) jTextArea1.append(rs.getString(1)+"\t"+rs.getString(2)+"\t"+rs.getString(3)+"\t"+ rs.getString(4)+"\t"+rs.getString(5)+"\t"+rs.getString(6)+"\t"+ rs.getString(7)+"\t"+rs.getString(8)+"\t"+rs.getString(9)+"\n"); } catch(SQLException ex) { System.err.println("SQLException:"+ex.getMessage( )); } /**String input=null; javax.swing.JFrame f=new javax.swing.JFrame(); input=javax.swing.JOptionPane.showInputDialog(f,"请输入sql叙述 如select*from renyuan","Input",javax.swing.JOptionPane.QUESTION_MESSAGE); //int returnValue=javax.swing.JOptionPane.CANCEL_OPTION; System.out.println("数据查询........."); if((input!=null)&&(input.length()!=0)){ System.out.println(input); //进行数据库查询 try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ce){ System.out.println("SQLException:"+ce.getMessage()); } try{ Connection con=DriverManager.getConnection("jdbc:odbc:houqin"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(input); // System.out.println(zc.face.MySqlUnit.printMetaData(rs)); System.out.println(zc.face.MySqlUnit.printResultSet(rs)); stmt.close(); con.close(); } catch(SQLException e){ System.out.println("SQLException:"+e.getMessage()); } catch(IOException e2){ System.out.println("IOException:"+e2.getMessage()); } } else System.out.println("输入正确的查询语句."); */ }//GEN-LAST:event_jMenuItem2ActionPerformed private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed zc.JFrame1 jf1=new zc.JFrame1(); jf1.setVisible(true); setVisible(false); // Add your handling code here: }//GEN-LAST:event_jMenuItem4ActionPerformed /** 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 userInterface2().show (); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenu jMenu1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenu jMenu2; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem11; private javax.swing.JMenu jMenu4; private javax.swing.JMenuItem jMenuItem5; private javax.swing.JMenu jMenu7; private javax.swing.JMenuItem jMenuItem6; private javax.swing.JMenuItem jMenuItem12; private javax.swing.JMenuItem jMenuItem13; private javax.swing.JMenu jMenu5; private javax.swing.JMenuItem jMenuItem7; private javax.swing.JMenuItem jMenuItem8; private javax.swing.JMenu jMenu6; private javax.swing.JMenuItem jMenuItem9; private javax.swing.JMenuItem jMenuItem10; private javax.swing.JMenu jMenu8; private javax.swing.JMenuItem jMenuItem14; private javax.swing.JMenu jMenu3; private javax.swing.JMenuItem jMenuItem4; 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 + -