Java固定资产管理系统源代码(共40页).doc





《Java固定资产管理系统源代码(共40页).doc》由会员分享,可在线阅读,更多相关《Java固定资产管理系统源代码(共40页).doc(40页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
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;im
2、port javax.swing.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;s
3、tatic 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;statictryClass.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);catch(Exception e)System.out.println(加载驱动失败);e.printStackTrace();public
4、 user_land()this.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(
5、清空);btn3=new 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.setDefaultC
6、loseOperation(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
7、().equals()=true) 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(登录失败,用户名/密码错误););b
8、tn1.addActionListener(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););prote
9、cted void user_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.
10、println(rs.getString(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();/关闭数据库finallyt
11、ryif(rs!=null)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);/ 主界面/pa
12、ckage com.newer.property;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dialog;import java.awt.FlowLayout;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenuBar;im
13、port javax.swing.JMenuItem;import javax.swing.JMenu;import javax.swing.JPanel;import javax.swing.JTextArea;import javax.swing.JTextField;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 j
14、mb=null;JMenu jm_1=null,jm_2=null,jm_3=null,jm_4=null;JLabel text;public Sys_interface()this.setTitle(固定资产及设备管理系统);text=new JLabel( 欢迎进入固定资产及设备管理系统);text.setFont(new Font(宋体,1,28);text.setForeground(Color.blue);p=new JPanel();jmb=new JMenuBar();jm_1=new JMenu(系统功能);jm_2=new JMenu(资产管理);jm_3=new JMen
15、u(系统查询);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_1
16、.add(jmi_1);jm_1.add(jmi_2);jm_1.add(jmi_3);jm_1.add(jmi_4);jm_2.add(jmi_5);jm_2.add(jmi_6);jm_3.add(jmi_7);jm_3.add(jmi_8);jm_3.add(jmi_9);jm_4.add(jmi_10);jmb.add(jm_1);jmb.add(jm_2);jmb.add(jm_3);jmb.add(jm_4);add(text,BorderLayout.CENTER);this.setJMenuBar(jmb);/this.setLayout(new BorderLayout();
17、/this.add(p,BorderLayout.NORTH);jmi_1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) new user_land().show(););jmi_2.addActionListener(this);jmi_2.addActionListener(new ActionListener() Overridepublic void actionPerformed(ActionEvent arg0) new user_land().show(););jm
18、i_3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) new Pass_word().show(););jmi_4.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e) System.exit(0););jmi_5.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Java 固定资产 管理 系统 源代码 40

限制150内