Java固定资产管理系统源代码

上传人:鲁** 文档编号:412753905 上传时间:2023-11-27 格式:DOC 页数:36 大小:122.50KB
返回 下载 相关 举报
Java固定资产管理系统源代码_第1页
第1页 / 共36页
Java固定资产管理系统源代码_第2页
第2页 / 共36页
Java固定资产管理系统源代码_第3页
第3页 / 共36页
Java固定资产管理系统源代码_第4页
第4页 / 共36页
Java固定资产管理系统源代码_第5页
第5页 / 共36页
点击查看更多>>
资源描述

《Java固定资产管理系统源代码》由会员分享,可在线阅读,更多相关《Java固定资产管理系统源代码(36页珍藏版)》请在金锄头文库上搜索。

1、/ 用户登录/package com.newer.property;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.*;import java.sql.Statement;import java.sql.ResultSet;import javax.swing.JButton;import javax.swing.JLabel;import javax.swing.JTextField;import javax.sw

2、ing.JPasswordField;import javax.swing.JPanel;import javax.swing.JFrame;public class user_land extends JFrame implements ActionListenerstatic 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

3、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;statictryClass.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);catch(Exception e)System.out.println(加载驱动失败);e.printStackTrace();public user_land()t

4、his.setTitle(固定资产及设备用户登录);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

5、JButton(退出);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(new GridLayout(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

6、(EXIT_ON_CLOSE);this.setVisible(true);/添加按钮登录事件btn1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) if(txt_name.getText().equals()=true)&(txt_pwd.getText().equals()=false) lbl4.setText(登录失败,用户名不能为空); if(txt_name.getText().equals()=false)&(txt_pwd.getText().equals()=t

7、rue) lbl4.setText(登录失败,密码不能为空); if(txt_name.getText().equals()=true)&(txt_pwd.getText().equals()=true) lbl4.setText(登录失败,用户名/密码不能为空);if(is_Property() new Sys_interface().show(); else if(txt_name.getText().equals()=false)&(txt_pwd.getText().equals()=false) lbl4.setText(登录失败,用户名/密码错误););btn1.addAction

8、Listener(this);/清空用户名和密码btn2.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) txt_name.setText(null);txt_pwd.setText(null);lbl4.setText(null););/退出btn3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) System.exit(0););protected void use

9、r_land(Object setVisible) / TODO Auto-generated method stubpublic boolean is_Property()tryconn=DriverManager.getConnection(url, user, password);/System.out.println(连接成功);stat=conn.createStatement();String sql=select * from Admin_Info;rs=stat.executeQuery(sql);while(rs.next()/System.out.println(rs.ge

10、tString(A_name)+t+rs.getString(A_pwd); String name=txt_name.getText();String pwd=txt_pwd.getText();if(name.equals(rs.getString(A_name) & pwd.equals(rs.getString(A_pwd)/System.out.println(登录成功!);return true;catch(SQLException e)System.out.println(连接失败!);e.printStackTrace();/关闭数据库finallytryif(rs!=null

11、)rs.close();if(stat!=null)stat.close();if(conn!=null)conn.close();catch(Exception e2)System.out.println(关闭失败);e2.printStackTrace();return false;public static void main(String args) new user_land();public void actionPerformed(ActionEvent e) /System.exit(0);this.setVisible(false);/ 主界面/package com.newer.property;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dialog;import java.awt.FlowLayout;impor

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作计划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号