《数据库应用》课程设计——人事管理系统(java源代码).docx
《《数据库应用》课程设计——人事管理系统(java源代码).docx》由会员分享,可在线阅读,更多相关《《数据库应用》课程设计——人事管理系统(java源代码).docx(140页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、数据库应用课程设计人事管理系统(java 源代码)/用户登陆类package classsource; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*;public class Land extends JFrame JFrame jf ;JTextField textName=new JTextField(); JPasswordField textage=new JPasswordField(); JLabel label = new JLabel(员工管理系统); JL
2、abel labelName=new JLabel( 用 户 名 :); JLabel labelage=new JLabel( 密 码 :); JButton buttonEnter=new JButton( 登 录 ); JButton buttoncancel=new JButton( 清 空 ); public Land()jf=this; setTitle(登录);Font f = new Font(新宋体,Font.PLAIN,12); Container con = getContentPane(); con.setLayout(null); label.setBounds(95
3、,10,110,20);label.setFont(new Font(新宋体,Font.PLAIN,14);con.add(label); labelName.setBounds(45,40,55,20); labelName.setFont(f); con.add(labelName); textName.setBounds(95,40,120,20); con.add(textName); labelage.setBounds(45,70,45,20); con.add(labelage); labelage.setFont(f); textage.setBounds(95,70,120,
4、20); con.add(textage); buttonEnter.setBounds(90,110,60,20); buttonEnter.setFont(f); con.add(buttonEnter);/ 登 陆 的 鼠 标 监 听 buttonEnter.addMouseListener(new MouseAdapter() public void mouseClicked(MouseEvent me) if(textName.getText().equals()new JOptionPane().showMessageDialog(null,用户名不能为空!);else if(te
5、xtage.getText().equals()new JOptionPane().showMessageDialog(null,密码不能为空!);elseString sql=select * from UserInformation where User_Name = + textName.getText() + and Password = + textage.getText()+ ;System.out.println(sql); Judge(sql););buttoncancel.setBounds(155,110,60,20); buttoncancel.setFont(f); c
6、on.add(buttoncancel);/清空按钮的鼠标监听方法buttoncancel.addMouseListener(new MouseAdapter() public void mouseClicked(MouseEvent me) textName.setText();textage.setText(););setResizable(false);Image img=Toolkit.getDefaultToolkit().getImage(imagemain.gif); setIconImage(img);Toolkit t = Toolkit.getDefaultToolkit(
7、); int w = t.getScreenSize().width;int h = t.getScreenSize().height; setBounds(w/2-150,h/2-90,300,180);setVisible(true);private void Judge(String sqlString) if (Database.joinDB() if (Database.query(sqlString) try if(Database.rs.isBeforeFirst() System.out.println(密码正确); jf.setVisible(false); D.close(
8、);new Main();else System.out.println(错误);new JOptionPane().showMessageDialog(null,用户名或密码错误!,JOptionPane.ERROR_MESSAGE);catch(Exception ex) System.out.println(ex.getMessage();elseSystem.out.println(连接数据库不成功);public static void main(String args) new Land();/主函数类,可以独立运行package classsource; import java.
9、awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*;public class Main extends JFrame implements Runnable Thread t=new Thread(this);JDesktopPane deskpane = new JDesktopPane(); JPanel p = new JPanel();Label lp1=new Label( 欢 迎 使 用 员 工 管 理 系 统 !);ImageIconicon1=newImageIcon(imagetjsc
10、.gif);ImageIconicon2=newImageIcon(imagecxdl.gif);ImageIconicon3=newImageIcon(imagexgmm.gif);ImageIconicon4=newImageIcon(imagetcxt.gif);ImageIconicon5=newImageIcon(imagejj.gif);ImageIconicon6=newImageIcon(imagehelp.gif);ImageIconicon7=newImageIcon(imagecx.gif);ImageIconicon8=newImageIcon(imagegl.gif)
11、;ImageIcon icon9=new ImageIcon(imagext.gif); ImageIcon icon10=new ImageIcon(imagexxgl.gif); ImageIcon icon11=new ImageIcon(imagexxcx.gif); ImageIcon icon12=new ImageIcon(imagebz.gif); ImageIcon icon13=new ImageIcon(imagegy.gif); ImageIcon icon14=new ImageIcon(imageglxx.gif); ImageIcon icon15=new Ima
12、geIcon(imagecxxx.gif);/完public Main()setTitle( 员 工 管 理 系 统 ); Container con = getContentPane(); con.setLayout(new BorderLayout();con.add(deskpane,BorderLayout.CENTER); Font f =new Font(新宋体,Font.PLAIN,12); JMenuBar mb = new JMenuBar();JMenu systemM = new JMenu(系统管理); systemM.setFont(f);JMenu manageM
13、= new JMenu(信息管理); manageM.setFont(f);JMenu employeeMM = new JMenu(员工信息管理); employeeMM.setFont(f);JMenu selectM = new JMenu(信息查询);selectM.setFont(f);JMenu employeeSM =new JMenu(员工信息查询); employeeSM.setFont(f);JMenu helpM = new JMenu(帮助); helpM.setFont(f);JMenu aboutM=new JMenu(关于); aboutM.setFont(f);
14、JMenuItem password = new JMenuItem(密码修改); password.setFont(f);JMenuItem land = new JMenuItem(重新登陆); land.setFont(f);JMenuItem addDelete = new JMenuItem(添加/删除用户); addDelete.setFont(f);JMenuItem exit = new JMenuItem(退出系统); exit.setFont(f);systemM.add(password); systemM.add(land); systemM.add(addDelete
15、); systemM.add(exit);/为系统管理菜单加事件password.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) System.out.println(AmendPassword); deskpane.add(new AmendPassword(););land.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) System.out.println(L
16、and); setVisible(false);new Land(););addDelete.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) deskpane.add(new AddDeleteUser(););exit.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e)/new JOptionPane().showMessageDialog( setVisible(f
17、alse););JMenuItem departmentM = new JMenuItem(部门信息管理); departmentM.setFont(f);JMenuItem employeeM = new JMenuItem(基本信息管理); employeeM.setFont(f);JMenuItem trainM = new JMenuItem(培训信息管理); trainM.setFont(f);JMenuItem encouragementPunishM = new JMenuItem(奖罚信息管理); encouragementPunishM.setFont(f);JMenuIte
18、m wageM =new JMenuItem(薪资信息管理); wageM.setFont(f);employeeMM.add(trainM); employeeMM.add(employeeM); employeeMM.add(encouragementPunishM); employeeMM.add(wageM); manageM.add(employeeMM); manageM.add(departmentM);/ 为 管 理 菜 单 加 事 件 departmentM.addActionListener(new ActionListener() public void actionPe
19、rformed(ActionEvent e) System.out.println(Departmentmanage); deskpane.add(new Departmentmanage(););employeeM.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) System.out.println(Employeemanage); deskpane.add(new Employeemanage(););trainM.addActionListener(new ActionLi
20、stener() public void actionPerformed(ActionEvent e) System.out.println(Trainmanage); deskpane.add(new Trainmanage(););encouragementPunishM.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) System.out.println(EncouragementPunish);deskpane.add(new EncouragementPunish();
21、);wageM.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) System.out.println(WageManage); deskpane.add(new WageManage(););JMenuItem departmentS = new JMenuItem(部门信息查询); departmentS.setFont(f);JMenuItem employeeS = new JMenuItem(基本信息查询); employeeS.setFont(f);JMenuItem
22、trainS = new JMenuItem(培训信息查询);trainS.setFont(f);JMenuItem encouragementPunishS = new JMenuItem(奖罚信息查询); encouragementPunishS.setFont(f);JMenuItem wageS =new JMenuItem(薪资信息查询); wageS.setFont(f);employeeSM.add(trainS); employeeSM.add(employeeS); employeeSM.add(encouragementPunishS); employeeSM.add(wa
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据库应用 数据库 应用 课程设计 人事管理系统 java 源代码
限制150内