Java固定资产管理系统源代码Word版Word格式.docx

上传人:b****0 文档编号:13182231 上传时间:2022-10-07 格式:DOCX 页数:56 大小:28.74KB
下载 相关 举报
Java固定资产管理系统源代码Word版Word格式.docx_第1页
第1页 / 共56页
Java固定资产管理系统源代码Word版Word格式.docx_第2页
第2页 / 共56页
Java固定资产管理系统源代码Word版Word格式.docx_第3页
第3页 / 共56页
Java固定资产管理系统源代码Word版Word格式.docx_第4页
第4页 / 共56页
Java固定资产管理系统源代码Word版Word格式.docx_第5页
第5页 / 共56页
点击查看更多>>
下载资源
资源描述

Java固定资产管理系统源代码Word版Word格式.docx

《Java固定资产管理系统源代码Word版Word格式.docx》由会员分享,可在线阅读,更多相关《Java固定资产管理系统源代码Word版Word格式.docx(56页珍藏版)》请在冰豆网上搜索。

Java固定资产管理系统源代码Word版Word格式.docx

staticConnectionconn=null;

staticStatementstat=null;

staticResultSetrs=null;

staticStringurl="

jdbc:

sqlserver:

//127.0.0.1:

1433;

DatabaseName=_Property"

;

staticStringuser="

sa"

staticStringpassword="

"

JPanelp1,p2,p3,p4,p5;

JLabellbl1,lbl2,lbl3,lbl4;

JTextFieldtxt_name;

JPasswordFieldtxt_pwd;

JButtonbtn1,btn2,btn3;

static{

try{

Class.forName("

com.microsoft.sqlserver.jdbc.SQLServerDriver"

);

}catch(Exceptione){

System.out.println("

加载驱动失败"

e.printStackTrace();

}

}

publicuser_land(){

this.setTitle("

固定资产及设备用户登录"

p1=newJPanel();

p2=newJPanel();

p3=newJPanel();

p4=newJPanel();

p5=newJPanel();

lbl1=newJLabel("

欢迎登录"

lbl2=newJLabel("

用户名:

lbl3=newJLabel("

密码:

lbl4=newJLabel();

txt_name=newJTextField(10);

txt_pwd=newJPasswordField(10);

btn1=newJButton("

登录"

btn2=newJButton("

清空"

btn3=newJButton("

退出"

p1.add(lbl1);

p2.add(lbl2);

p2.add(txt_name);

p3.add(lbl3);

p3.add(txt_pwd);

p4.add(btn1);

p4.add(btn2);

p4.add(btn3);

p5.add(lbl4);

this.setLayout(newGridLayout(5,1));

this.add(p1);

this.add(p2);

this.add(p3);

this.add(p4);

this.add(p5);

this.setBounds(400,300,400,300);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

this.setVisible(true);

//添加按钮登录事件

btn1.addActionListener(

newActionListener(){

publicvoidactionPerformed(ActionEvente){

if((txt_name.getText().equals("

)==true)&

&

(txt_pwd.getText().equals("

)==false))

lbl4.setText("

登录失败,用户名不能为空"

)==false)&

)==true))

登录失败,密码不能为空"

登录失败,用户名/密码不能为空"

if(is_Property()){

newSys_interface().show();

}

elseif((txt_name.getText().equals("

登录失败,用户名/密码错误"

}

}

);

btn1.addActionListener(this);

//清空用户名和密码

btn2.addActionListener(

newActionListener(){

publicvoidactionPerformed(ActionEvente){

txt_name.setText(null);

txt_pwd.setText(null);

lbl4.setText(null);

}

);

//退出

btn3.addActionListener(

System.exit(0);

protectedvoiduser_land(ObjectsetVisible){

//TODOAuto-generatedmethodstub

publicbooleanis_Property(){

conn=DriverManager.getConnection(url,user,password);

//System.out.println("

连接成功"

stat=conn.createStatement();

Stringsql="

select*fromAdmin_Info"

rs=stat.executeQuery(sql);

while(rs.next()){

//System.out.println(rs.getString("

A_name"

)+"

\t"

+rs.getString("

A_pwd"

));

Stringname=txt_name.getText();

Stringpwd=txt_pwd.getText();

if(name.equals(rs.getString("

))&

pwd.equals(rs.getString("

))){

//System.out.println("

登录成功!

returntrue;

}catch(SQLExceptione){

连接失败!

!

//关闭数据库

finally{

try{

if(rs!

=null){

rs.close();

if(stat!

stat.close();

if(conn!

conn.close();

}catch(Exceptione2){

System.out.println("

关闭失败"

e2.printStackTrace();

returnfalse;

publicstaticvoidmain(String[]args){

newuser_land();

publicvoidactionPerformed(ActionEvente){

//System.exit(0);

this.setVisible(false);

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

主界面

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

importjava.awt.BorderLayout;

importjava.a

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 幼儿教育 > 幼儿读物

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1