您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 绩效管理 > java考勤管理系统数据库实现
14.2设计代码Java源程序:importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.awt.*;importjava.sql.*;importjava.lang.*;importjava.util.*;importjavax.swing.table.*;importjava.math.*;classDB_LSimplementsActionListener{JFrameframe=newJFrame(欢迎进入LS工资管理系统);JLabellabel=newJLabel(09网络2_54_李胜,JLabel.CENTER);JButtonbutton1=newJButton(进入系统);JButtonbutton2=newJButton(退出系统);ImageIconim=newImageIcon(1.jpg);JLabela1=newJLabel(im);voidCreate(){JPanelpcontentPane=(JPanel)frame.getContentPane();JPanelpcontentPane1=newJPanel();pcontentPane.add(label);pcontentPane.setLayout(newFlowLayout());pcontentPane.add(button1);pcontentPane.add(button2);pcontentPane.add(newLabel());pcontentPane.add(a1);pcontentPane.setBackground(Color.green);pcontentPane.setVisible(true);button1.addActionListener(this);button2.addActionListener(this);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setBounds(200,100,550,600);frame.setVisible(true);}publicstaticvoidmain(String[]args){DB_LSdome=newDB_LS();dome.Create();}publicvoidactionPerformed(ActionEvente){2if(button1.equals(e.getSource())){DLdl=newDL();dl.create();}if(button2.equals(e.getSource())){//退出System.exit(0);}}}classDLimplementsActionListener{JFrameframe=newJFrame(职工/管理员登陆);JLabellabel1=newJLabel(用户名);JLabellabel2=newJLabel(密码);JButtonlogonButton1=newJButton(管理员登录);JButtonlogonButton2=newJButton(职工登录);JButtoncancelButton=newJButton(退出);JTextFieldt1=newJTextField(0);JTextFieldt2=newJTextField(0);ImageIconim=newImageIcon(2.jpg);JLabela2=newJLabel(im);JTextFieldusername=newJTextField(9);JPasswordFieldpassword=newJPasswordField(9);voidcreate(){JPanelp=(JPanel)frame.getContentPane();JPanelp1=newJPanel();p.setLayout(newFlowLayout());p.add(label1);p.setSize(5,5);p.setLocation(4,8);p.add(username);p.setSize(100,200);p.setLocation(800,800);p.add(label2);p.setSize(50,20);p.setLocation(40,80);p.add(password);p.setSize(100,20);p.setLocation(80,120);p.add(logonButton1);p.add(newJLabel());3p.add(logonButton2);p.add(newJLabel());p.add(cancelButton);p.add(newJLabel());p.add(a2);p.add(t1);p.add(t2);p.setBackground(Color.blue);p.setVisible(true);logonButton1.addActionListener(this);logonButton2.addActionListener(this);cancelButton.addActionListener(this);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setBounds(200,100,750,550);frame.setVisible(true);}publicvoidactionPerformed(ActionEvente){if(logonButton1.equals(e.getSource())&&(username.getText().equals(123)==true)&&(password.getText().equals(123)==true)){GZGLZJMgz=newGZGLZJM();gz.create();}else{JOptionPane.showMessageDialog(null,对不起,你输入的密码错误!);};if(logonButton2.equals(e.getSource())&&(username.getText().equals(t1.getText())==true)&&(password.getText().equals(t2.getText())==true)){XKxk=newXK();xk.create();Connectioncon;Statementsql;ResultSetrs;Vectorvector=newVector();try{Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);}catch(ClassNotFoundExceptione1){System.out.println(+e1);}try{con=DriverManager.getConnection(jdbc:odbc:123,,);4sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);sql.executeQuery(SELECTGno,mmFROMYWHEREGno=+t1.getText()+ANDmm=+t2.getText());}catch(SQLExceptione1){System.out.println(e1);}}if(cancelButton.equals(e.getSource())){System.exit(0);}}}classGZGLZJMextendsJFrameimplementsActionListener{JFramef=newJFrame(工资管理系统);JButtonb1=newJButton(津贴管理);JButtonb2=newJButton(总查询);JButtonb3=newJButton(工资管理);JButtonb4=newJButton(后勤管理);JButtonb6=newJButton(员工个人信息管理);JButtonb5=newJButton(返回);ImageIconim=newImageIcon(3.jpg);JLabela3=newJLabel(im);voidcreate(){JPanelp=(JPanel)f.getContentPane();JPanelp1=newJPanel();p.setLayout(newFlowLayout());p.add(b1);p.add(newJLabel());p.add(b6);p.add(newJLabel());p.add(b3);p.add(newJLabel());p.add(b4);p.add(newJLabel());p.add(b2);p.add(newJLabel());p.add(b5);p.add(a3);p.setBackground(Color.red);p.setVisible(true);b1.addActionListener(this);5b2.addActionListener(this);b3.addActionListener(this);b4.addActionListener(this);b5.addActionListener(this);b6.addActionListener(this);f.setBounds(200,100,800,600);f.setVisible(true);}publicvoidactionPerformed(ActionEvente){if(b5.equals(e.getSource())){//返回DLd=newDL();f.dispose();}if(b1.equals(e.getSource())){//津贴管理JTGLjt=newJTGL();jt.create();}if(b6.equals(e.getSource())){//员工个人信息管理YGGLyg=newYGGL();yg.create();}if(b2.equals(e.getSource())){//查询XKxk=newXK();xk.create();}if(b4.equals(e.getSource())){//后勤管理KQGLkq=newKQGL();kq.create();}if(b3.equals(e.getSource())){//工资管理GZGLgz=newGZGL();gz.create();}}}classKQGLimplementsActionListener{JFramef=newJFrame(录入修改删除考勤信息);JButtonb1=newJButton(录入);JButtonb2=newJButton(修改);JButtonb3=newJButton(删除);JButtonb4=newJButton(查询所有);6JButtonb5=newJButton(返回);JTextFieldtf1=newJTextField(4);JTextFieldtf2=newJTextField(4);JTextFieldtf3=newJTextField(4);JTextFieldtf4=newJTextField(4);JTextFieldtf5=newJTextField(6);JButtonb6=newJButton(查询单人考勤);String[]cloum={职工号,缺勤天数,缺勤类别,缺勤时间};Object[][]row=newObject[50][4];JTabletable=newJTable(row,cloum);JScrollPanescrollpane=newJScrollPane(t
本文标题:java考勤管理系统数据库实现
链接地址:https://www.777doc.com/doc-5325814 .html