1、addActionListener(this); button2.addActionListener(this); frame。setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();setBounds(200,100,550,600);setVisible(true); public static void main(String args) DB_LS dome=new DB_LS(); dome。Create(); public void actionPerformed(ActionEvent e) if(button1。
2、equals(e.getSource() DL dl=new DL(); dl.create(); if(button2.equals(e。getSource()/退出 System。exit(0); class DL implements ActionListener JFrame frame=new JFrame(职工/管理员登陆”); JLabel label1=new JLabel(”用户名”); JLabel label2=new JLabel(”密码 JButton logonButton1=new JButton(”管理员登录”); JButton logonButton2=ne
3、w JButton(”职工登录); JButton cancelButton=new JButton(退出 JTextField t1=new JTextField(0); JTextField t2=new JTextField(0); ImageIcon im=new ImageIcon(2。 JLabel a2=new JLabel(im); JTextField username=new JTextField(9); JPasswordField password=new JPasswordField(9); void create() JPanel p=(JPanel)frame.g
4、etContentPane(); JPanel p1=new JPanel(); p。setLayout(new FlowLayout(); p.add(label1);setSize(5,5);setLocation(4,8);add(username);setSize(100,200); p.setLocation(800,800); p.add(label2); p.setSize(50,20);setLocation(40,80); p.add(password);setSize(100,20);setLocation(80,120); p.add(logonButton1);add(
5、new JLabel( ); p.add(logonButton2);add(cancelButton); ”);add(a2); p.add(t1);add(t2); p.setBackground(Color.blue); p.setVisible(true); logonButton1.addActionListener(this); logonButton2.addActionListener(this); cancelButton。addActionListener(this); frame.setDefaultCloseOperation(JFrame。EXIT_ON_CLOSE)
6、;pack(); frame.setBounds(200,100,750,550); frame.setVisible(true); public void actionPerformed(ActionEvent e) if(logonButton1.equals(e。getSource()&(username。getText()。equals(”123”)=true)&(password。equals(”123)=true) GZGLZJM gz=new GZGLZJM(); gz。create(); elseJOptionPane。showMessageDialog(null,”对不起,你
7、输入的密码错误! ; if(logonButton2。equals(e.getSource()(username.getText()。equals(t1.getText()=true)&equals(t2.getText()=true) XK xk=new XK(); xk.create(); Connection con; Statement sql; ResultSet rs; Vector vector=new Vector(); try Class.forName(”sun。jdbc。odbc。JdbcOdbcDriver”); catch (ClassNotFoundExceptio
8、n e1) System。out。println(” + e1); try con = DriverManager.getConnection(”jdbc:odbc:123”, ”, sql = con。createStatement(ResultSet。TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); sql.executeQuery(SELECT Gno,mm FROM Y WHERE Gno=+t1.getText() +AND mm=+t2.getText(); catch (SQLException e1) out.println(
9、e1); if(cancelButton。equals(e.getSource()exit(0); class GZGLZJM extends JFrame implements ActionListener JFrame f=new JFrame(”工资管理系统 JButton b1=new JButton(”津贴管理 JButton b2=new JButton(”总查询”); JButton b3=new JButton(”工资管理 JButton b4=new JButton(”后勤管理”); JButton b6=new JButton(员工个人信息管理 JButton b5=new
10、 JButton(返回 ImageIcon im=new ImageIcon(3。jpg JLabel a3=new JLabel(im); void create() JPanel p=(JPanel)f.getContentPane(); JPanel p1=new JPanel();setLayout(new FlowLayout(); p.add(b1); p.add(new JLabel(” ”); p.add(b6); p.add(new JLabel( p.add(b3); p.add(new JLabel(” ”); p.add(b4); p.add(b2);add(b5);a
11、dd(a3); p.setBackground(Color.red);setVisible(true); b1。 b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); f。setBounds(200,100,800,600); public void actionPerformed(ActionEvent e) if(b5。equals(e.getSource()/返回
12、DL d=new DL(); f。dispose(); if(b1。equals(e。getSource()/津贴管理 JTGL jt=new JTGL(); jt。create(); if(b6.equals(e。getSource()/员工个人信息管理 YGGL yg=new YGGL(); yg。 if(b2.equals(e.getSource()/查询 XK xk=new XK(); xk。 if(b4。getSource()/后勤管理 KQGL kq=new KQGL(); kq。 if(b3。getSource()/工资管理 GZGL gz=new GZGL(); class K
13、QGL implements ActionListener JFrame f=new JFrame(”录入修改删除考勤信息 JButton b1=new JButton(”录入”); JButton b2=new JButton(修改”); JButton b3=new JButton(删除 JButton b4=new JButton(”查询所有 JButton b5=new JButton(”返回 JTextField tf1=new JTextField(4); JTextField tf2=new JTextField(4); JTextField tf3=new JTextField
14、(4); JTextField tf4=new JTextField(4); JTextField tf5=new JTextField(6); JButton b6=new JButton(查询单人考勤”); String cloum=职工号”,”缺勤天数,”缺勤类别”,缺勤时间; Object row=new Object504; JTable table=new JTable(row,cloum); JScrollPane scrollpane=new JScrollPane(table); JSplitPane splitpane=new JSplitPane(JSplitPane。V
15、ERTICAL_SPLIT); void create() JPanel p=(JPanel)f.getContentPane(); p.setLayout(new FlowLayout(); /p。add(scrollpane); p.add(splitpane); p1。add(b1);add(b2); p1.add(b3);add(b4);add(b6); p1.add(b5); JPanel p2=new JPanel(); p2。setBackground(Color.red);add(scrollpane); JPanel p3=new JPanel(); p.setLayout(
16、new FlowLayout(); p。add(new JLabel(”职工号”);add(tf1);缺勤天数”); p.add(tf2);缺勤类别”); p.add(tf3); p.add(new JLabel( p.add(new JLabel(”缺勤时间”); p.add(tf4);add(new JLabel(” 在此处输入职工号点击查询删除 p.add(tf5); splitpane。add(p1,splitpane。TOP);add(p2,splitpane。BOTTOM); splitpane.setDividerLocation(50);setBackground(Color。
17、CYAN); b2。 b3。 b5。setBounds(200,100,500,600);setResizable(true);/可以调整界面大小 f.setVisible(true); if(b1。getSource() /添加 Connection con; Statement sql; ResultSet rs; Class.forName(”sun.jdbc。odbc.JdbcOdbcDriver”); catch (ClassNotFoundException e1) System.out。println(” + e1); try con = DriverManager。getCon
18、nection(jdbc:odbc:123”, ”, ”); sql = con.createStatement(); String insertStr = INSERT INTO K VALUES ” + (” + ” + tf1.getText() + ” + , + tf2.getText()+,” + ” +tf3。getText()+” + ”,”+tf4。)”; sql.executeUpdate(insertStr); con.close(); catch (SQLException e1) println(e1); if(b2.equals(e。getSource()/修改 C
19、onnection con; Statement sql; Class.forName(”sun。jdbc.odbc。JdbcOdbcDriver + e1); try con = DriverManager.getConnection(”jdbc:123, ”, sql.executeUpdate(UPDATE K SET ts=”+tf2。getText()+”WHERE Kno=”+tf1.getText()+ sql.executeUpdate(”UPDATE K SET lb=”+tf3.getText()+”WHERE Kno=+tf1.getText()+” sql.execut
20、eUpdate(”UPDATE K SET sj=+tf4.getText()+”WHERE Kno=”+tf1.getText()+ con。close(); System.out。 if(b3。getSource()/删除 Class。forName(sun。 System.out.println(getConnection(”jdbc:123”, ”, ” sql = con。DELETE FROM K WHERE Kno=”+tf5.getText();close(); System.out.println(e1); if(b4.equals(e。getSource()/查询全部 Ve
21、ctor vector=new Vector(); try Class。 catch (ClassNotFoundException e1) try con = DriverManager.getConnection(”jdbc:, sa”, ”); sql = con.createStatement(ResultSet。TYPE_SCROLL_SENSITIVE,ResultSet。CONCUR_READ_ONLY); if(b4。getSource() for(int i=0;i50;i+) for(int j=0;j4;j+) table。setValueAt(”,i,j) ; rs = sql。executeQuery(”SELECT FROM K ORD
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1