資源簡介
基于java swing開發(fā)的簡單房屋管理系統(tǒng)!代碼完整,數(shù)據(jù)庫用的是sql2005,內(nèi)有數(shù)據(jù)庫文件......

代碼片段和文件信息
package?allMethods;
import?java.awt.HeadlessException;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.sql.*;
import?java.util.ArrayList;
import?javax.swing.JButton;
import?javax.swing.JComboBox;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JOptionPane;
import?javax.swing.JPasswordField;
import?javax.swing.JTextField;
import?com.sun.java_cup.internal.internal_error;
/**
?*?功能:添加新用戶
?*?@author?Administrator
?*
?*/
public?class?addUsers?extends?Jframe?implements?ActionListener{
?//創(chuàng)建label標(biāo)簽
?private?JLabel?userName;??//用戶名
?private?JLabel?uPassword;?//密碼
?private?JLabel?type;
?//創(chuàng)建text
?private?JTextField?tfuserName;?//用戶名
?private?JPasswordField?tuPassword;?//密碼
?private?JComboBox??box;?//類型
?//創(chuàng)建按鈕
?private?JButton?btnAdd;?//添加
?private?JButton?btnCal;?//取消
?
?//創(chuàng)建要使用的sql對象
?private?basedao?dbconn?=new?basedao();
?private?Connection?conn?=?null;
?private?ResultSet?rs?=?null;
?private?PreparedStatement?pstmt?=null;
?private?Statement?stmt?=?null;
?
?basedao?dao=new?basedao();
?/*
??*?功能:創(chuàng)建頁面
??*/
?public?addUsers()?{
?
??this.setLayout(null);
??this.setBounds(10?10?300?200);
??this.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
??userName?=?new?JLabel(“用戶名:“);
??userName.setBounds(30?20?60?25);
??this.add(userName);
??tfuserName?=?new?JTextField();
??tfuserName.setBounds(80?20?160?25);
??this.add(tfuserName);
??uPassword?=?new?JLabel(“密????碼:“);
??uPassword.setBounds(30?55?60?25);
??this.add(uPassword);
??tuPassword?=?new?JPasswordField();
??tuPassword.setBounds(80?55?160?25);
??tuPassword.setEchoChar(‘*‘);
??this.add(tuPassword);
??JLabel?type=new?JLabel(“類????型:“);
??type.setBounds(30?90?60?25);
??this.add(type);
??
??box=new?JComboBox();
??box.setBounds(80?90?160?25);
??box.addItem(“用戶“);
??????box.addItem(“管理員“);
??????this.add(box);
??????
??????
??btnAdd?=?new?JButton(“注冊“);
??btnAdd.addActionListener(this);?//將btnAdd加入ActionEvent
??btnAdd.setBounds(80?130?60?30);
??this.add(btnAdd);
??
??btnCal?=?new?JButton(“取消“);
??btnCal.addActionListener(this);?//將btnDel加入ActionEvent
??btnCal.setBounds(160?130?60?30);
??this.add(btnCal);
??????
??????
??this.settitle(“添加用戶信息“);
??this.setResizable(false);
??this.setVisible(true);
?}
?
public?void?actionPerformed(ActionEvent?e)?{
if(e.getActionCommand().equals(“注冊“)){
if(tfuserName.getText().equals(““)?||?tuPassword.getText().equals(““)){
?JOptionPane.showMessageDialog(this“輸入的信息不能為空!“);
}else{
this.addUsers();
tfuserName.setText(““);
tuPassword.setText(““);
}
}else?if(e.getActionCommand().equals(“取消“)){
this.setVisible(false);?//隱藏窗體
}
}
????
/*
?*?功能:添加用戶信息
?*/
public?void?addUsers(){
try?{
conn=basedao.DBConnection();?//打
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????292??2009-10-11?11:05??房屋管理系統(tǒng)swing\.classpath
?????文件????????387??2009-10-10?16:08??房屋管理系統(tǒng)swing\.project
?????文件???????3812??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\addUsers.class
?????文件???????3820??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\addUsers.java
?????文件???????2121??2009-10-11?11:05??房屋管理系統(tǒng)swing\allMethods\ba
?????文件???????2303??2009-10-11?10:15??房屋管理系統(tǒng)swing\allMethods\ba
?????文件???????6774??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\houseInfo.class
?????文件???????8456??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\houseInfo.java
?????文件???????4259??2009-10-12?16:36??房屋管理系統(tǒng)swing\allMethods\MainMenu.class
?????文件???????4166??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\MainMenu.java
?????文件???????6425??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\Users.class
?????文件???????7042??2009-10-12?16:35??房屋管理系統(tǒng)swing\allMethods\Users.java
?????文件????????141??2009-10-10?17:08??房屋管理系統(tǒng)swing\java.policy.ap
?????文件????3145728??2009-10-12?16:51??房屋管理系統(tǒng)swing\SQL\HouseDB.mdf
?????文件????1048576??2009-10-12?16:51??房屋管理系統(tǒng)swing\SQL\HouseDB_log.ldf
?????文件?????253122??2009-10-11?11:04??房屋管理系統(tǒng)swing\SQLJDBC.JAR
?????目錄??????????0??2009-10-12?16:10??房屋管理系統(tǒng)swing\allMethods
?????目錄??????????0??2009-10-12?16:51??房屋管理系統(tǒng)swing\SQL
?????目錄??????????0??2009-10-12?16:51??房屋管理系統(tǒng)swing
-----------?---------??----------?-----??----
??????????????4497424????????????????????19
評論
共有 條評論