1、课程设计考勤管理系统源代码package kaoqin;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.sql.*;class AttendFrame extends JFrame/工作制类型 public AttendF
2、rame() this.setTitle(工作制类型); this.setVisible(true); this.setContentPane(new JPanel(); this.setSize(300,200); create(); private void create() JButton b1,b2,b3; Box box1,box2,box; b1=new JButton(非弹性工作制); b2=new JButton(弹性工作制); b3=new JButton(返回); box1=Box.createHorizontalBox(); box2=Box.createHorizont
3、alBox(); box=Box.createVerticalBox(); box1.add(b1); box1.add(Box.createHorizontalStrut(20); box1.add(b2); box2.add(b3); box.add(box1); box.add(Box.createVerticalStrut(30); box.add(box2); this.add(box); b1.addActionListener(new ActionListener() / Override public void actionPerformed(ActionEvent e) /
4、TODO 自动生成的方法存根 UBoundFrame frame=new UBoundFrame(); dispose(); ); b2.addActionListener(new ActionListener() / Override public void actionPerformed(ActionEvent e) / TODO 自动生成的方法存根 BoundFrame frame=new BoundFrame(); dispose(); ); b3.addActionListener(new ActionListener() / Override public void actionP
5、erformed(ActionEvent e) / TODO 自动生成的方法存根 MFrame frame=new MFrame(); dispose(); ); package kaoqin;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;im
6、port java.sql.*;class BoundFrame extends JFrame public BoundFrame() this.setTitle(弹性工作制); this.setVisible(true); this.setContentPane(new JPanel(); this.setSize(400,400); create(); JLabel k1,k2,k3,k4,k5,k6; JTextField f1,f2,f3,f4,f5,f6; Box box1,box2,box3,box4,box5,box; JButton b1; private void creat
7、e() k1=new JLabel(工号:); k2=new JLabel(姓名:); k3=new JLabel(当月工时:); k4=new JLabel(:); k5=new JLabel(当月工作天数); k6=new JLabel(当月富余:); b1=new JButton(返回); f1=new JTextField(5); f2=new JTextField(5); f3=new JTextField(5); f4=new JTextField(5); f5=new JTextField(5); f6=new JTextField(5); box1=Box.createHori
8、zontalBox(); box2=Box.createHorizontalBox(); box3=Box.createHorizontalBox(); box4=Box.createHorizontalBox(); box5=Box.createHorizontalBox(); box=Box.createVerticalBox(); box1.add(k1); box1.add(f1); box1.add(Box.createHorizontalStrut(20); box1.add(k2); box1.add(f2); box2.add(k3); box2.add(f3); box2.a
9、dd(k4); box2.add(f4); box3.add(k5); box3.add(f5); box4.add(k6); box4.add(f6); box5.add(b1); box.add(box1); box.add(Box.createVerticalStrut(20); box.add(box2); box.add(Box.createVerticalStrut(20); box.add(box3); box.add(Box.createVerticalStrut(20); box.add(box4); box.add(Box.createVerticalStrut(20);
10、box.add(box5); this.add(box); b1.addActionListener(new ActionListener() /确定 Override public void actionPerformed(ActionEvent e) / TODO 自动生成的方法存根 AttendFrame frame=new AttendFrame(); dispose(); ); package kaoqin;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import
11、 java.sql.SQLException;import java.sql.Statement;public class ConnectionDB private String JDriver=sun.jdbc.odbc.JdbcOdbcDriver; private String sqlURL=jdbc:odbc:bobo; /private String JDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver; /private String sqlURL=jdbc:sqlserver:/localhost:1433;DatabaseNa
12、me=MyTest;integratedSecurity=TRUE; private Connection connection; private Statement statement; private static Connection conn = null; private String tableSQL=new String4; public ConnectionDB() try Class.forName(JDriver); connection=DriverManager.getConnection(sqlURL); statement=connection.createStat
13、ement(); catch (ClassNotFoundException e) e.printStackTrace(); catch (SQLException e) e.printStackTrace(); public Connection getConnection() return connection; public Statement getStatement() return statement; public void breakDB() try statement.close(); connection.close(); catch (SQLException e) e.
14、printStackTrace(); public void createTable() tableSQL0=create table staff_info(+ Sno char(9) primary key,+ Sname char(10) not null,+ Sage smallint,+ enter_time char(10) not null,+ position char(10) not null,+ sex char(1),+ password char(6); tableSQL1=create table pz_info(+ arrive_hour char(2),+ arri
15、ve_minute char(2),+ leave_hour char(2),+ leave_minute char(2),+ everyday_time char(2); tableSQL2=create table everymonth_statistics(+ Sno char(9) not null,+ Sname char(10) not null,+ remain_time char(4),+ late_times smallint,+ early_leave smallint,+ work_day smallint,+ primary key(Sno),+ foreign key
16、(Sno)+ references staff_info(Sno) on delete cascade); tableSQL3=create table everyday_statistics(+ Sno char(9) not null,+ Sname char(10) not null,+ hour char(2),+ minute char(2),+ action char(6),+ time char(4),+ primary key(Sno),+ foreign key(Sno)+ references staff_info(Sno) on delete cascade); try
17、for(int i=0;i4;i+) statement.executeUpdate(tableSQLi); catch (SQLException e) e.printStackTrace(); private static ResultSet executeQuery(String sql) try if(conn=null) new ConnectionDB(); return conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql); catch
18、(SQLException e) e.printStackTrace(); return null; finally package kaoqin;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.sql.*;class E
19、qu_Frame extends JFrame /配置信息 public Equ_Frame() this.setTitle(配置信息); this.setSize(400,400); this.setContentPane(new JPanel(); this.setVisible(true); this.create(); JLabel k1,k2,k3,k4,k5,k6,k7,k8,k9,k10; JLabel f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; Box box1,box2,box3,box4,box5,box6,box7,box; JButton b1,b2
20、; private void create() k1=new JLabel(上班时间:); k2=new JLabel(:); k3=new JLabel(下班时间:); k4=new JLabel(:); k5=new JLabel(每月工作总时间:); k6=new JLabel(每月工作天数:); k7=new JLabel(每月工作日期:); k8=new JLabel(); k9=new JLabel(每月放假日期:); k10=new JLabel(); b1=new JButton(修改); b2=new JButton(返回); f1=new JLabel(08); f2=ne
21、w JLabel(30); f3=new JLabel(17); f4=new JLabel(30); f5=new JLabel(200); f6=new JLabel(22); f7=new JLabel(星期一); f8=new JLabel(星期五); f9=new JLabel(星期六); f10=new JLabel(星期日); box1=Box.createHorizontalBox(); box2=Box.createHorizontalBox(); box3=Box.createHorizontalBox(); box4=Box.createHorizontalBox();
22、box5=Box.createHorizontalBox(); box6=Box.createHorizontalBox(); box7=Box.createHorizontalBox(); box=Box.createVerticalBox(); box1.add(k1); box1.add(f1); box1.add(k2); box1.add(f2); box2.add(k3); box2.add(f3); box2.add(k4); box2.add(f4); box3.add(k5); box3.add(f5); box4.add(k6); box4.add(f6); box5.ad
23、d(k7); box5.add(f7); box5.add(k8); box5.add(f8); box6.add(k9); box6.add(f9); box6.add(k10); box6.add(f10); box7.add(b1); box7.add(Box.createHorizontalStrut(20); box7.add(b2); box.add(box1); box.add(Box.createVerticalStrut(20); box.add(box2); box.add(Box.createVerticalStrut(20); box.add(box3); box.ad
24、d(Box.createVerticalStrut(20); box.add(box4); box.add(Box.createVerticalStrut(20); box.add(box5); box.add(Box.createVerticalStrut(20); box.add(box6); box.add(Box.createVerticalStrut(20); box.add(box7); this.add(box); b1.addActionListener(new ActionListener() /确定 Override public void actionPerformed(
25、ActionEvent e) / TODO 自动生成的方法存根 EquAltFrame frame=new EquAltFrame(); dispose(); ); b2.addActionListener(new ActionListener() /确定 Override public void actionPerformed(ActionEvent e) / TODO 自动生成的方法存根 MFrame frame=new MFrame(); dispose(); ); package kaoqin;import javax.swing.*;import java.awt.*;import
26、java.awt.event.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.sql.*;class EquAltFrame extends JFrame /修改配置信息 public EquAltFrame() this.setTitle(修改配置信息); this.setSize(400,400); this.setContentPane
27、(new JPanel(); this.setVisible(true); this.create(); JLabel k1,k2,k3,k4,k5,k6,k7,k8,k9,k10; JTextField f1,f2,f3,f4,f5,f6,f7,f8,f9,f10; Box box1,box2,box3,box4,box5,box6,box7,box; JButton b1,b2; private void create() k1=new JLabel(上班时间:); k2=new JLabel(:); k3=new JLabel(下班时间:); k4=new JLabel(:); k5=n
28、ew JLabel(每月工作总时间:); k6=new JLabel(每月工作天数:); k7=new JLabel(每月工作日期:); k8=new JLabel(); k9=new JLabel(每月放假日期:); k10=new JLabel(); b1=new JButton(保存); b2=new JButton(取消); f1=new JTextField(5); f2=new JTextField(5); f3=new JTextField(5); f4=new JTextField(5); f5=new JTextField(5); f6=new JTextField(5); f7=new
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1