UserManagement.java~6~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:4k
源码类别:
Java编程
开发平台:
Java
- package uml_gaokai;
- import java.awt.*;
- import javax.swing.*;
- import com.borland.dbswing.*;
- import com.borland.jbcl.layout.*;
- import com.borland.dx.sql.dataset.*;
- import java.awt.event.*;
- import java.sql.*;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author unascribed
- * @version 1.0
- */
- public class UserManagement extends JDialog {
- private JPanel panel1 = new JPanel();
- private XYLayout xYLayout1 = new XYLayout();
- private JdbTable jdbTable1 = new JdbTable();
- private QueryDataSet queryDataSet1 = new QueryDataSet();
- private Database database1 = new Database();
- private TableScrollPane tableScrollPane1 = new TableScrollPane();
- private JButton jButton1 = new JButton();
- private JButton jButton2 = new JButton();
- private JButton jButton3 = new JButton();
- private JButton jButton4 = new JButton();
- private JButton jButton5 = new JButton();
- public UserManagement(Frame frame, String title, boolean modal) {
- super(frame, title, modal);
- try {
- jbInit();
- pack();
- }
- catch(Exception ex) {
- ex.printStackTrace();
- }
- }
- public UserManagement() {
- this(null, "", false);
- }
- private void jbInit() throws Exception {
- panel1.setLayout(xYLayout1);
- database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:gaokaiSQL", "sa", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
- queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT [user].userID,[user].userName,[user].userPassword,[user].userAddress,[user].userAuthority,[use" +
- "r].userGender,[user].userAge FROM [UML_CS].[dbo].[user]", null, true, Load.ALL));
- jButton1.setText("增加用户");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jButton1_actionPerformed(e);
- }
- });
- jButton2.setText("修改用户");
- jButton3.setText("删除用户");
- jButton3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jButton3_actionPerformed(e);
- }
- });
- jButton4.setText("查看用户");
- jButton4.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jButton4_actionPerformed(e);
- }
- });
- jButton5.setText("退出");
- getContentPane().add(panel1);
- panel1.add(jdbTable1, new XYConstraints(-1, 0, 389, 253));
- panel1.add(tableScrollPane1, new XYConstraints(215, 192, -1, -1));
- panel1.add(jButton2, new XYConstraints(4, 290, 99, 25));
- panel1.add(jButton3, new XYConstraints(109, 290, 104, 26));
- panel1.add(jButton1, new XYConstraints(112, 255, 100, 26));
- panel1.add(jButton4, new XYConstraints(2, 255, 99, 27));
- panel1.add(jButton5, new XYConstraints(316, 292, 72, 24));
- }
- void jButton4_actionPerformed(ActionEvent e) {
- jdbTable1.setDataSet(queryDataSet1) ;
- }
- //增加用户
- void jButton1_actionPerformed(ActionEvent e) {
- Registration registration = new Registration() ;
- Dimension dlgSize = registration.getPreferredSize();
- Dimension frmSize = getSize();
- Point loc = getLocation();
- registration.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
- registration.setModal(true);
- registration.pack();
- registration.show();
- }
- void jButton3_actionPerformed(ActionEvent e) {
- DeleteUser deleteUser = new DeleteUser() ;
- Dimension dlgSize = deleteUser.getPreferredSize();
- Dimension frmSize = getSize();
- Point loc = getLocation();
- deleteUser.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
- deleteUser.setModal(true);
- deleteUser.pack();
- deleteUser.show();
- }
- }