2024年3月28日发(作者:)
/////////////////////////////////////////////////////////////////////////////////////////////////////
用户登录
/////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import yout;
import Event;
import Listener;
import .*;
import ent;
import Set;
import n;
import ;
import ield;
import ordField;
import ;
import ;
public class user_land extends JFrame implements ActionListener{
static Connection conn=null;
static Statement stat=null;
static ResultSet rs=null;
static String url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_Property";
static String user="sa";
static String password="";
JPanel p1,p2,p3,p4,p5;
JLabel lbl1,lbl2,lbl3,lbl4;
JTextField txt_name;
JPasswordField txt_pwd;
JButton btn1,btn2,btn3;
static{
try{
e("verDriver");
}catch(Exception e){
n("加载驱动失败");
tackTrace();
}
}
public user_land(){
le("固定资产及设备用户登录");
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
p5=new JPanel();
lbl1=new JLabel("欢迎登录");
lbl2=new JLabel("用户名:");
lbl3=new JLabel("密 码:");
lbl4=new JLabel();
txt_name=new JTextField(10);
txt_pwd=new JPasswordField(10);
btn1=new JButton("登录");
btn2=new JButton("清空");
btn3=new JButton("退出");
(lbl1);
(lbl2);
(txt_name);
(lbl3);
(txt_pwd);
(btn1);
(btn2);
(btn3);
(lbl4);
out(new GridLayout(5,1));
(p1);
(p2);
(p3);
(p4);
(p5);
nds(400, 300, 400, 300);
aultCloseOperation(EXIT_ON_CLOSE);
ible(true);
//添加按钮登录事件
ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
if((txt_t().equals("")==true)&&(txt_t().equals("")==false))
t("登录失败,用户名不能为空");
if((txt_t().equals("")==false)&&(txt_t().equals("")==true))
t("登录失败,密码不能为空");
if((txt_t().equals("")==true)&&(txt_t().equals("")==true))
t("登录失败,用户名/密码不能为空");
if(is_Property()){
new Sys_interface().show();
}
else
if((txt_t().equals("")==false)&&(txt_t().equals("")==false))
t("登录失败,用户名/密码错误");
}
}
);
ionListener(this);
//清空用户名和密码
ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
txt_t(null);
txt_t(null);
t(null);
}
}
);
//退出
ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
(0);
}
}
);
}
protected void user_land(Object setVisible) {
// TODO Auto-generated method stub
}
public boolean is_Property(){
try{
conn=nection(url, user, password);
//n("连接成功");
stat=Statement();
String sql="select * from Admin_Info";
rs=eQuery(sql);
while(()){
//n(ing("A_name")+"t"+ing("A_pwd"));
String name=txt_t();
String pwd=txt_t();
if((ing("A_name"))
(ing("A_pwd"))){
//n("登录成功!!");
return true;
}
}
}catch(SQLException e){
n("连接失败");
tackTrace();
}
//关闭数据库
finally{
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
&&
}
}
return false;
}
public static void main(String[] args) {
new user_land();
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
主界面
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import Layout;
import ;
import ;
import yout;
import ;
import Event;
import Listener;
import ;
import ;
import ar;
import tem;
import ;
import ;
import rea;
import ield;
public class Sys_interface extends JFrame implements ActionListener {
JPanel p=null;
JMenuItem jmi_1,jmi_2,jmi_3,jmi_4,jmi_5,jmi_6,jmi_7,jmi_8,jmi_9,jmi_10;
JMenuBar jmb=null;
JMenu jm_1=null,jm_2=null,jm_3=null,jm_4=null;
JLabel text;
public Sys_interface(){
le("固定资产及设备管理系统");
text=new JLabel(" 欢迎进入固定资产及设备管理系统");
t(new Font("宋体",1,28));
eground();
p=new JPanel();
jmb=new JMenuBar();
jm_1=new JMenu("系统功能");
jm_2=new JMenu("资产管理");
jm_3=new JMenu("系统查询");
jm_4=new JMenu("帮助");
jmi_1=new JMenuItem("用户登录");
jmi_2=new JMenuItem("注销用户");
jmi_3=new JMenuItem("用户添加");
jmi_4=new JMenuItem("退出系统");
jmi_5=new JMenuItem("资产借出管理");
jmi_6=new JMenuItem("资产信息管理");
jmi_7=new JMenuItem("资产信息查询");
jmi_8=new JMenuItem("资产借出查询");
jmi_9=new JMenuItem("资产归还查询");
jmi_10=new JMenuItem("关于");
jm_(jmi_1);
jm_(jmi_2);
jm_(jmi_3);
jm_(jmi_4);
jm_(jmi_5);
jm_(jmi_6);
jm_(jmi_7);
jm_(jmi_8);
jm_(jmi_9);
jm_(jmi_10);
(jm_1);
(jm_2);
(jm_3);
(jm_4);
add(text,);
nuBar(jmb);
//out(new BorderLayout());
//(p,);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new user_land().show();
}
}
);
jmi_ionListener(this);
jmi_ionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
new user_land().show();
}
});
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new Pass_word().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
(0);
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new loan_prop_manage().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new property_Info().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new prop_info_select().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new Loan_prop_select().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new back_prop_select ().show();
}
}
);
jmi_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
new about().show();
}
}
);
nds(200,200,500,400);
aultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
public static void main(String[] args) {
new Sys_interface().show();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
资产借出管理
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import .*;
import Event;
import Listener;
import .*;
import ;
import .*;
import vent;
import istener;
import vent;
import istener;
import lectionEvent;
import lectionListener;
import odelListener;
import odelEvent;
import tTableModel;
import odel;
public class loan_prop_manage extends JFrame implements ActionListener{
Vector
DefaultTableModel model = null;
Connection conn=null;
Statement stat=null;
ResultSet rs1=null;
JTable loan_prop=null;
JLabel label;
JTextField text;
JTextField txt01,txt02,txt03,txt04,txt05,txt06;
JPanel p1=null,p2=null,p3=null,p4,p5,p6,p7,p8,p9,p10;
Choice c1=null,c2=null;
JLabel lb1=null,lb2=null,lb3=null,lb4=null,lb5=null,lb6=null;
JButton btn_ok=null;
JButton btn_exit=null;
JButton btn_fresh=null;
JButton btn_save=null;
JButton btn_del=null;
Vector
public loan_prop_manage(){
text=new JTextField();
("资产编号");
("资产名称");
("资产型号");
("借出时间");
("借出数量");
("借出人");
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
p5=new JPanel();
p6=new JPanel();
p7=new JPanel();
p8=new JPanel();
p9=new JPanel();
p10=new JPanel();
lb1=new JLabel("资产编号");
lb2=new JLabel("资产名称");
lb3=new JLabel("资产型号");
lb4=new JLabel("借出时间");
lb5=new JLabel("借出数量");
lb6=new JLabel("借 出 人");
txt01=new JTextField(8);
txt02=new JTextField(8);
txt03=new JTextField(8);
txt04=new JTextField(8);
txt05=new JTextField(8);
txt06=new JTextField(8);
c1=new Choice();
c2=new Choice();
text=new JTextField(5);
("资产编号");
("=");
btn_ok=new JButton("确定");
btn_exit=new JButton("退出");
btn_fresh=new JButton("刷新");
btn_save=new JButton("保存");
btn_del=new JButton("删除");
(new JLabel("查询字段"));
(c1);
(new JLabel("运算符"));
(c2);
(new JLabel("输入数据"));
(text);
(btn_ok);
(btn_exit);
der(TitledBorder("请操作"));
(lb1);
(txt01);
(lb2);
(txt02);
(lb3);
(txt03);
(lb4);
(txt04);
(lb5);
(txt05);
(lb6);
(txt06);
(btn_fresh);
(btn_save);
(btn_del);
out(new GridLayout(3, 2));
(p3);
(p4);
(p5);
(p6);
(p7);
(p8);
loan_prop=new JTable(e(),columnName);
model = new DefaultTableModel(getDate(),columnName);
(new JScrollPane(loan_prop));
out(new GridLayout(4, 1));
(p1);
(p9);
(p2);
(p10);
nds(400,300,500,400);
aultCloseOperation(EXIT_ON_CLOSE);
le("资产借出管理");
btn_ionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
String sql="insert into loan_info
(prop_name,prop_type,loan_time,loan_num)"+"values('"+t()+"','"+t()+"','
"+t()+"','"+t()+"')";
eUpdate(sql);
DefaultTableModel mod= new
DefaultTableModel(getDate(),columnName);
loan_el(mod);
loan_t();
loan_UI();
}catch(Exception e){
n(sage());
}
try{
if(rs1!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
});
btn_ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
DefaultTableModel dtb=new
DefaultTableModel(selectDate(),columnName);
loan_el(dtb);
loan_t();
loan_UI();
}
});
/*btn_ionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
}
});*/
btn_ionListener(this);
btn_ionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
DefaultTableModel mod = new
DefaultTableModel(getDate(),columnName);
loan_el(mod);
loan_t();
loan_UI();
}
});
loan_ectionModel().addListSelectionListener(
new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e){
btn_ionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
try{
int j= loan_ectedRow();
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
String sql1="delete from loan_info where
prop_id="+""+(j).get(0)+"";
eUpdate(sql1);
}catch(Exception ee){
n(sage());
}finally{
try{
if(rs1!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}
catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
DefaultTableModel mod = new
DefaultTableModel(getDate(),columnName);
loan_el(mod);
loan_t();
loan_UI();
}
});
}
});
loan_ectionModel().addListSelectionListener(
new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e){
int i= loan_ectedRow();
t((i).get(0).toString());
t((String)(i).get(1));
t((String)(i).get(2));
t((i).get(3).toString());
t((i).get(4).toString());
t((i).get(5).toString());
}
});
}
public Vector selectDate(){
data=new Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
int x=nt(t().trim());
//n(x);
rs1=eQuery("select * from loan_info where prop_id="+x);
while(()){
Vector al=new Vector();
(("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(e("loan_time"));
(("loan_num"));
(ing("u_name"));
(al);
}
}catch(Exception e){
tackTrace();
}finally{
try{
if(rs1!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public Vector getDate(){
data=new Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
rs1=eQuery("select * from loan_info");
while(()){
Vector al=new Vector();
(("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(e("loan_time"));
(("loan_num"));
(ing("u_name"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
try{
if(rs1!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public static void main(String[] args){
new loan_prop_manage().show();
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
资产借出查询
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import .*;
import ist;
import n;
import .*;
import ield;
import ;
import Layout;
import ;
import yout;
import Factory;
import ;
import ;
import ;
import lPane;
import ;
import tTableModel;
public class Loan_prop_select extends JFrame implements ActionListener{
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
JTable table=null;
JLabel label;
JTextField text;
JButton btn_ok=null,btn_exit=null;
JPanel p1=null,p2=null;
Vector
public Loan_prop_select(){
le("资产借出查询");
("流水号");
("资产编号");
("借用人");
("借出数量");
("借出时间");
p1=new JPanel();
p2=new JPanel();
text=new JTextField();
text=new JTextField(5);
btn_ok=new JButton("查询");
btn_exit=new JButton("退出");
(new JLabel("资产编号"));
(text);
(btn_ok);
(btn_exit);
der(TitledBorder("数据查询"));
btn_ionListener(this);
table=new JTable(e(),columnName);
out(new BorderLayout());
(p1,);
(new JScrollPane(table),);
nds(400,300,500,400);
aultCloseOperation(EXIT_ON_CLOSE);
btn_ionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
DefaultTableModel dtm=new DefaultTableModel(selectDate(),columnName);
el(dtm);
t();
UI();
}
});
}
public Vector selectDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
int x=nt(t().trim());
//n(x);
rs=eQuery("select * from loan_info where prop_id="+x);
while(()){
Vector al=new Vector();
(ing("loan_id"));
(ing("prop_id"));
(ing("u_id"));
(ing("loan_num"));
(ing("loan_time"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public Vector getDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
rs=eQuery("select * from loan_Info");
while(()){
Vector al=new Vector();
(ing("loan_id"));
(ing("prop_id"));
(ing("u_id"));
(ing("loan_num"));
(ing("loan_time"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public static void main(String[] args) {
new Loan_prop_select().show();
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
资产归还查询
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import .*;
import ;
import Layout;
import Event;
import Listener;
import vent;
import istener;
import vent;
import istener;
import Factory;
import ;
import ;
import ield;
import n;
import ;
import lPane;
import ;
import tTableModel;
import odel;
import lectionEvent;
import lectionListener;
import odelEvent;
import odelListener;
public class back_prop_select extends JFrame implements ActionListener {
Vector
DefaultTableModel model=null;
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
JPanel pa1,pa2;
JButton btn1,btn2;
JTable tab=null;
JTextField tex=null;
JTextField txt1,txt2,txt3,txt4,txt5;
JLabel lab1,lab2,lab3;
Vector columnName=new Vector();
public back_prop_select(){
("流水号");
("资产编号");
("借用人");
("借用数量");
("借用时间");
("归还数量");
("归还时间");
pa1=new JPanel();
pa2=new JPanel();
btn1=new JButton("确定");
btn2=new JButton("退出");
lab1=new JLabel("查询字段:");
lab2=new JLabel("借用人");
tex=new JTextField(5);
tab=new JTable(e(),columnName);
txt1=new JTextField(10);
txt2=new JTextField(10);
txt3=new JTextField(10);
txt4=new JTextField(10);
txt5=new JTextField(10);
(lab1);
(lab2);
(tex);
(btn1);
(btn2);
(tab);
model = new DefaultTableModel(getDate(),columnName);
tab=new JTable(model);
der(TitledBorder("查询参数"));
(new JScrollPane(tab));
le("资产归还查询");
out(new BorderLayout());
(pa1,);
(new JScrollPane(tab));
nds(300,200,500,300);
aultCloseOperation(EXIT_ON_CLOSE);
//查询
ionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e) {
//1、定义一个方法
//2、更新表格的显示
DefaultTableModel dtm=new DefaultTableModel(selectDate(),
columnName);
el(dtm);
t();
UI();
}
}
);
/*ectionModel().addListSelectionListener(
new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e) {
int x=ectedRow();
t((String)(x).get(0));
t((String)(x).get(1));
t((String)(x).get(2));
t((String)(x).get(3));
t((x).get(4).toString());
}
}
);*/
//选中显示
/*ectionModel().addListSelectionListener(
new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e) {
int x=ectedRow();
t((String)(x).get(0));
t((String)(x).get(1));
t((String)(x).get(2));
t((x).get(3).toString());
}
}
);*/
ionListener(this);
}
public Vector getDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=Proper
ty","sa","123");
stat=Statement();
rs=eQuery("select * from loan_Info");
while(()){
Vector al=new Vector();
(ing("loan_id"));
(ing("prop_id"));
(ing("u_id"));
(ing("loan_time"));
(ing("loan_num"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public Vector selectDate(){
data=new Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=Proper
ty","sa","123");
stat=Statement();
String lab1="select * from loan_info where u_id='"+t().trim()+"'";
rs=eQuery(lab1);
while(()){
Vector back=new Vector();
(ing("loan_id"));
(ing("prop_id"));
(ing("u_id"));
(ing("loan_time"));
(("loan_num"));
(back);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public static void main(String[] args) {
new back_prop_select().show();
}
public void tableChanged(TableModelEvent e) {
}
public void actionPerformed(ActionEvent e) {
ible(false);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
资产信息管理
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//资产信息管理
package ty;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import ist;
import ;
import yout;
import yout;
import ;
import lPane;
import ;
import Listener;
import Event;
import n;
import Box;
import ;
import ;
import ield;
import odelEvent;
import odelListener;
import tTableModel;
import odel;
public class property_Info extends JFrame implements ActionListener {
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
JPanel p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12;
JButton b1,b2,b3,b4,b5;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,text_show;
JTable table=null;
JComboBox cob;
String sql;
Vector
public property_Info(){
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
p5=new JPanel();
p6=new JPanel();
p7=new JPanel();
p8=new JPanel();
p9=new JPanel();
p10=new JPanel();
p11=new JPanel();
p12=new JPanel();
b1=new JButton("刷新");
b2=new JButton("存盘");
b3=new JButton("退出");
b4=new JButton("删除");
b5=new JButton("确定");
l1=new JLabel("产品编号");
l2=new JLabel("产品名称");
l3=new JLabel("产品类型");
l4=new JLabel("产品总量");
l5=new JLabel("产品价格");
l6=new JLabel("产品厂商");
l7=new JLabel("购买日期");
l8=new JLabel("出产日期");
l9=new JLabel("购 买 人");
l10=new JLabel("产品名称");
t1=new JTextField(10);
t2=new JTextField(10);
t3=new JTextField(10);
t4=new JTextField(10);
t5=new JTextField(10);
t6=new JTextField(10);
t7=new JTextField(10);
t8=new JTextField(10);
t9=new JTextField(10);
text_show=new JTextField(10);
("产品编号");
("产品名称");
("产品类型");
("产品总量");
("产品价格");
("产品厂商");
("购买时间");
("出厂日期");
("购 买 人");
cob = new JComboBox();
(l2);
(t2);
(l3);
(t3);
(l4);
(t4);
(l5);
(t5);
(l6);
(t6);
(l7);
(t7);
(l8);
(t8);
(l9);
(t9);
(p4);
(p5);
(p6);
(p7);
(p8);
(p9);
(p10);
(p11);
(b1);
(b2);
(b3);
(b4);
(l10);
m("产品编号");
m("产品名称");
m("产品类型");
(cob);
(text_show);
(b5);
(p12);
(p1);
(p2);
(p3);
table=new JTable(e(),columnName);
out(new FlowLayout());
out(new GridLayout(4,1));
out(new FlowLayout());
out(new GridLayout(4,2));
(new JScrollPane(table));
nds(400,400,600,400);
ible(true);
le("资产信息管理表");
aultCloseOperation(EXIT_ON_CLOSE);
ionListener(
new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
//刷新,重新显示数据。
DefaultTableModel dtm=new
DefaultTableModel(getDate(),columnName);
el(dtm);
t();
UI();
}
}
);
ionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
String sql="insert into prop_Info
(prop_name,prop_type,prop_num,prop_price,prop_commdity,prop_buyTime,prop_proTime,prop_
purchaser)"+"values('"+t()+"','"+t()+"','"+t()+"','"+t()+"','"+t6
.getText()+"','"+t()+"','"+t()+"','"+t()+"')";
eUpdate(sql);
}catch(Exception e){
n(sage());
}
}
});
ionListener(this);
ionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
DefaultTableModel dtm=new DefaultTableModel(selectDate(),columnName);
el(dtm);
t();
UI();
}
});
}
public Vector getDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_Prop
erty","sa","");
stat=Statement();
rs=eQuery("select * from prop_Info");
while(()){
Vector al=new Vector();
(ing("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(ing("prop_num"));
(ing("prop_price"));
(ing("prop_commdity"));
(ing("prop_buyTime"));
(ing("prop_proTime"));
(ing("prop_purchaser"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public Vector selectDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_Prop
erty","sa","");
stat=Statement();
String x=ectedItem().toString();
int y=nt(text_t().trim());
//n(y);
rs=eQuery("select * from prop_info where prop_id="+y);
while(()){
Vector v=new Vector();
(ing("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(ing("prop_num"));
(ing("prop_price"));
(ing("prop_commdity"));
(ing("prop_buyTime"));
(ing("prop_proTime"));
(ing("prop_purchaser"));
(v);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
public static void main(String[] args) {
new property_Info();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
资产信息查询
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package ty;
import yout;
import ;
import ield;
import ;
import .*;
import ;
import lPane;
import .*;
import Layout;
import ;
import Factory;
import ;
import ;
import n;
import tTableModel;
public class prop_info_select extends JFrame implements ActionListener{
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
JTable table=null;
JLabel label;
JTextField text;
JButton btn_ok=null,btn_exit=null;
JPanel p1=null,p2=null;
Choice c1=null,c2=null;
public static void main(String[] args) {
new prop_info_select().show();
}
Vector
public prop_info_select(){
le("资产设备信息情况查询");
nds(0, 0, 500, 300);
out(new FlowLayout());
JTable prop_info=null;
("设备编号");
("设备名称");
("设备型号");
("设备数量");
("库存数量");
("设备价格");
("出厂商家");
("生产时间");
("购买时间");
("购买者");
p1=new JPanel();
p2=new JPanel();
c1=new Choice();
c2=new Choice();
text=new JTextField();;
text=new JTextField(5);
("设备编号");
("=");
btn_ok=new JButton("确定");
btn_exit=new JButton("取消");
(new JLabel("查询字段"));
(c1);
(new JLabel("运算符"));
(c2);
(new JLabel("数量"));
(text);
(btn_ok);
(btn_exit);
der(TitledBorder("查询数据"));
btn_ionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
DefaultTableModel dtm=new
DefaultTableModel(selectDate(),columnName);
el(dtm);
t();
UI();
}
});
btn_ionListener(this);
table=new JTable(e(),columnName);
out(new BorderLayout());
(p1,);
(new JScrollPane(table),);
nds(400,300,500,400);
aultCloseOperation(EXIT_ON_CLOSE);
}
public Vector selectDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
int x=nt(t().trim());
//n(x);
rs=eQuery("select * from prop_info where prop_id="+x);
while(()){
Vector al=new Vector();
(("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(("prop_num"));
(("prop_spare"));
(at("prop_price"));
(ing("prop_commdity"));
(e("prop_proTime"));
(e("prop_buyTime"));
(ing("prop_purchaser"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
public Vector getDate(){
Vector
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_prop
erty","sa","");
stat=Statement();
rs=eQuery("select * from prop_Info");
while(()){
Vector al=new Vector();
(("prop_id"));
(ing("prop_name"));
(ing("prop_type"));
(("prop_num"));
(("prop_spare"));
(at("prop_price"));
(ing("prop_commdity"));
(e("prop_proTime"));
(e("prop_buyTime"));
(ing("prop_purchaser"));
(al);
}
}catch(Exception e){
n(sage());
}finally{
//关闭
try{
if(rs!=null){
();
}
if(stat!=null){
();
}
if(conn!=null){
();
}
}catch(Exception e2){
n("关闭失败");
tackTrace();
}
}
return data;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
管理员添加
/////////////////////////////////////////////////////////////////////////////////
package ty;
import Layout;
import Event;
import Listener;
import tion;
import Manager;
import ent;
import n;
import ;
import ;
import ;
import ield;
import Exception;
public class Pass_word extends JFrame implements ActionListener{
Connection conn=null;
Statement stat=null;
JButton btn1,btn2;
JLabel lb1,lb2,lb3,lb4;
JTextField txt1,txt2,txt3,txt4;
JPanel pa1,pa2,pa3;
public Pass_word(){
pa1=new JPanel();
pa2=new JPanel();
pa3=new JPanel();
btn1=new JButton("增加");
btn2=new JButton("退出");
lb1=new JLabel("用户 ID");
lb2=new JLabel("用户姓名");
lb3=new JLabel("用户口令");
lb4=new JLabel("重复口令");
txt1=new JTextField(10);
txt2=new JTextField(10);
txt3=new JTextField(10);
txt4=new JTextField(10);
(lb1);
(txt1);
(lb2);
(txt2);
(lb3);
(txt3);
(lb4);
(txt4);
(btn1);
(btn2);
out(new BorderLayout());
(pa3, );
(pa1, );
(pa2, );
nds(200, 300, 500, 150);
aultCloseOperation(EXIT_ON_CLOSE);
le("用户添加管理");
ionListener(
new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
e("verDriver");
conn=nection("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=_Prop
erty","sa","");
stat=Statement();
String sql="insert into
admin_info(a_pwd,a_name)"+"values('"+t()+"','"+t()+"')";
eUpdate(sql);
n("添加成功");
}catch(Exception e){
n(sage());
}
}
}
);
//退出
ionListener(this);
}
public void actionPerformed(ActionEvent e) {
//(0);
ible(false);
}
public static void main(String[] args) {
new Pass_word().show();
}
}
///////////////////////////////////////////////////////////////////////////////////
关于
////////////////////////////////////////////////////////////////////////////////////
package ty;
import Layout;
import ;
import ;
import ;
import ;
public class about extends JFrame {
JLabel text;
public about(){
text=new JLabel();
nds(300, 300, 200, 200);
le("关于");
text=new JLabel(" 实训第四组成员出品");
t(new Font("宋体",1,16));
eground();
add(text,);
}
public static void main(String[] args) {
new about().show();
}
}
注:本系统由第四小组共同完成。小组成员:吕斌、盛渊、吴瑶、周敏、彭璨婷


发布评论