UserManagement.java~3~
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:3k
源码类别:

Java编程

开发平台:

Java

  1. package uml_gaokai;
  2. import java.awt.*;
  3. import javax.swing.*;
  4. import com.borland.dbswing.*;
  5. import com.borland.jbcl.layout.*;
  6. import com.borland.dx.sql.dataset.*;
  7. import java.awt.event.*;
  8. import java.sql.*;
  9. /**
  10.  * <p>Title: </p>
  11.  * <p>Description: </p>
  12.  * <p>Copyright: Copyright (c) 2003</p>
  13.  * <p>Company: </p>
  14.  * @author unascribed
  15.  * @version 1.0
  16.  */
  17. public class UserManagement extends JDialog {
  18.   private JPanel panel1 = new JPanel();
  19.   private XYLayout xYLayout1 = new XYLayout();
  20.   private JdbTable jdbTable1 = new JdbTable();
  21.   private QueryDataSet queryDataSet1 = new QueryDataSet();
  22.   private Database database1 = new Database();
  23.   private TableScrollPane tableScrollPane1 = new TableScrollPane();
  24.   private JButton jButton1 = new JButton();
  25.   private JButton jButton2 = new JButton();
  26.   private JButton jButton3 = new JButton();
  27.   private JButton jButton4 = new JButton();
  28.   private JButton jButton5 = new JButton();
  29.   public UserManagement(Frame frame, String title, boolean modal) {
  30.     super(frame, title, modal);
  31.     try {
  32.       jbInit();
  33.       pack();
  34.     }
  35.     catch(Exception ex) {
  36.       ex.printStackTrace();
  37.     }
  38.   }
  39.   public UserManagement() {
  40.     this(null, "", false);
  41.   }
  42.   private void jbInit() throws Exception {
  43.     panel1.setLayout(xYLayout1);
  44.     database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:gaokaiSQL", "sa", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
  45.     queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT [user].userID,[user].userName,[user].userPassword,[user].userAddress,[user].userAuthority,[use" +
  46.       "r].userGender,[user].userAge FROM [UML_CS].[dbo].[user]", null, true, Load.ALL));
  47.     jButton1.setText("增加用户");
  48.     jButton2.setText("修改用户");
  49.     jButton3.setText("删除用户");
  50.     jButton4.setText("查看用户");
  51.     jButton4.addActionListener(new java.awt.event.ActionListener() {
  52.       public void actionPerformed(ActionEvent e) {
  53.         jButton4_actionPerformed(e);
  54.       }
  55.     });
  56.     jButton5.setText("退出");
  57.     getContentPane().add(panel1);
  58.     panel1.add(jdbTable1,              new XYConstraints(-1, 0, 389, 253));
  59.     panel1.add(tableScrollPane1,  new XYConstraints(215, 192, -1, -1));
  60.     panel1.add(jButton2,  new XYConstraints(4, 290, 99, 25));
  61.     panel1.add(jButton3,  new XYConstraints(109, 290, 104, 26));
  62.     panel1.add(jButton1,  new XYConstraints(112, 255, 100, 26));
  63.     panel1.add(jButton4,     new XYConstraints(2, 255, 99, 27));
  64.     panel1.add(jButton5,  new XYConstraints(316, 292, 72, 24));
  65.   }
  66.   void jButton4_actionPerformed(ActionEvent e) {
  67.     jdbTable1.setDataSet(queryDataSet1) ;
  68.   }
  69. }