人事工资管理系统附录文件源代码.pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《人事工资管理系统附录文件源代码.pdf》由会员分享,可在线阅读,更多相关《人事工资管理系统附录文件源代码.pdf(29页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、bm。javaimport java.awt。;import java。awt。event。;import java。sql。*;import javax.swing.;class bm extends Frame implements ActionListener,ItemListener privatecondb conx=null;private ResultSet rs=null;private String sql=null;private Label num=new Label(”职工号”);private Label jb=new Label(税收);private Label
2、fj=new Label(医疗保险”);private Label in=new Label(”退休保险”);private TextField numtx=new TextField();private TextField jbtx=new TextField();private TextField fjtx=new TextField();private TextField intx=new TextField();private Choice numcho=new Choice();private Button add=new Button(增加”);private Button exi
3、t=new Button(退出”);public bm()setTitle(扣除工资);setSize(400,300);setBackground(Color.LIGHT_GRAY);this。setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);num。setBounds(80,50,50,20);jb.setBounds(80,80,50,20);fj。setBounds(80,110,50,20);in.setBounds(80,140,50,20);numtx.setBound
4、s(160,50,100,20);jbtx。setBounds(160,80,100,20);fjtx。setBounds(160,110,100,20);intx.setBounds(160,140,100,20);numcho。setBounds(160,170,100,20);add.setBounds(60,220,50,20);exit.setBounds(300,220,50,20);add(add);add(exit);add(num);add(jb);add(fj);add(in);add(numtx);add(jbtx);add(fjtx);add(intx);add(num
5、cho);/lbadd。addActionListener(this);exit。addActionListener(this);numcho.addItemListener(this);initnumcho();setVisible(true);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void itemStateChanged(ItemEvent i)numtx。setText(numcho。getSelectedItem();public
6、void initnumcho()conx=new condb();sql=”select*from 扣除工资”;numcho。removeAll();try rs=conx.getrs(conx.con,sql);while(rs.next()numcho.add(rs。getString(职工号”);conx。dbclose(conx。con,rs);conx=null;rs=null;catch(Exception eo)public void actionPerformed(ActionEvent e)conx=new condb();if(e.getActionCommand()。e
7、quals(退出”)this.dispose();if(e.getActionCommand().equals(增加)sql=”select from 扣除工资 where 职工号=”+numtx.getText()+”;try rs=conx.getrs(conx.con,sql);if(rs。next())sql=insert into 扣除工资(职工号,税收,医疗保险,养老保险)+values(+numtx。getText()。trim()+”,”+jbtx。getText()+,”+fjtx。getText()+”,+intx。getText()+);try System。out。pr
8、intln(sql);conx.dbclose(conx.con,null);catch(Exception ue)System.out.println(+ue);JOptionPane jop=new JOptionPane();jop。showMessageDialog(null,扣除工资添加成功!,”添加成功,1);conx.dbclose(conx。con,rs);numtx。setText(”)jbtx。setText(”);fjtx.setText(”);conx=null;rs=null;else JOptionPane jop=new JOptionPane();jop。sho
9、wConfirmDialog(null,”添加失败!”,警告!”,1);conx.dbclose(conx.con,rs);conx=null;rs=null;catch(SQLException et)System.out。println(”+et);/*else/bmcx.javaimport java.awt。;import java.awt。event.;import java。sql。;import javax.swing.;import java.awt.Window;class bmcx extends Frame implements ActionListenerprivate
10、 condb conc=null;private ResultSet rs=null;private String sql=null;private Label chao=new Label(职工号:);private Label cname=new Label(”姓名:”);private Label csex=new Label(”税收:”);private Label cage=new Label(医疗保险:);private Label cdep=new Label(”退休保险:);private TextField chaotx=new TextField();private Lab
11、el cnametx=new Label();private Label csextx=new Label(”);private Label cagetx=new Label(”);private Label cdeptx=new Label(”);private Button cx=new Button(查询”);private Button tc=new Button(”退出);public bmcx()setTitle(”扣除工资查询);setSize(400,250);setBackground(Color。LIGHT_GRAY);this.setLocationRelativeTo(
12、this.getParent();this。setResizable(false);setLayout(null);chao.setBounds(80,50,50,20);cname.setBounds(80,80,50,20);csex.setBounds(80,110,50,20);cage.setBounds(80,140,50,20);cdep.setBounds(80,170,50,20);chaotx。setBounds(160,50,150,20);cnametx。setBounds(160,80,150,20);csextx.setBounds(160,110,150,20);
13、cagetx.setBounds(160,140,150,20);cdeptx。setBounds(140,170,150,20);cx.setBounds(60,205,50,20);tc.setBounds(300,205,50,20);add(chao);add(cname);add(cagetx);add(cage);add(csex);add(cdep);add(chaotx);add(cnametx);add(csextx);add(cdeptx);add(cx);add(tc);setVisible(true);cx。addActionListener(this);tc.addA
14、ctionListener(this);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent e)if(e.getActionCommand()。equals(退出”))this.dispose();if(e。getActionCommand()。equals(”查询)conc=new condb();sql=”select 姓名,税收,医疗保险,退休保险 from 扣除工资,职工 where
15、 扣除工资。职工号=职工。职工号 and 扣除工资。职工号=+chaotx.getText()+”;try rs=conc。getrs(conc.con,sql);if(rs。next()cnametx。setText(rs。getString(”姓名”);csextx.setText(rs。getString(税收);cagetx.setText(rs。getString(”医疗保险”));cdeptx.setText(rs.getString(”退休保险”));conc。dbclose(conc。con,rs);conc=null;rs=null;else JOptionPane jop=
16、new JOptionPane();jop。showConfirmDialog(null,该用户不存在!”,警告,-1);catch(Exception ee)condb.javaimport java.sql.*;public class condb public Connection con;/在类头定义连接对象public condb()/在此构造方法中实现有关程序的加载,同时捕捉异常。try Class。forName(sun.jdbc.odbc.JdbcOdbcDriver);/加载驱动程序catch(java.lang。ClassNotFoundException e)System
17、。out.println(error);try con=DriverManager.getConnection(”jdbc:odbc:xin”);/连接数据源catch(SQLException e)System。out。println(”connect database error!);public ResultSet getrs(Connection con,String sql)/自定义查询数据库返回记录集的方法。ResultSet rs=null;tryStatement stmt=con.createStatement();/创建发送 sql 语句的对象 stmt。rs=stmt。e
18、xecuteQuery(sql);/执行查询语句 sql,得记录集。catch(Exception e)System。out.println(”+e)return rs;/getrs()中行参 sql 为实现数据库查询的查询语句,con 表示数据库连接对象。public void moddb(Connection con,String sql)/自定义具有对数据库实现增加,删除,修改功能的方法:try Statement stmt=con.createStatement();/创建发送 sql 语句的对象 stmt。stmt。executeUpdate(sql);/实现增加,删除,修改数据库等
19、操作。catch(Exception e)/方法.executeUpdate()根据 sql 语句实现对数据库的增加,删除,修改功能.public void dbclose(Connection con,ResultSet rs)/定义关闭连接对象和记录集的方法 try con。close();/关闭连接对象rs.close();/关闭记录集catch(SQLException rse)dl.javaimport java.awt。*;import java。awt。event。;import java.sql。*;import javax.swing.*;import java.awt。ge
20、om.*;class denglu extends Framepublic Label name=new Label(用户名);public Label pass=new Label(”密码”);public TextField txtname=new TextField();public TextField txtpass=new TextField();public Button btok=new Button(登陆”);public Button btexit=new Button(取消”);public condb conu=new condb();private String sql
21、=null;private ResultSet rs=null;private Image img;public denglu()img=getToolkit().getImage(getClass().getResource(”/ww。jpg));setTitle(欢迎使用工资管理系统);setLayout(null);setResizable(false);setSize(500,350);Dimension scr=Toolkit。getDefaultToolkit()。getScreenSize();Dimension frm=this。getSize();setLocation(sc
22、r.widthfrm。width)/2,(scr。height-frm。height)/2-18);txtpass。setEchoChar(*);txtname.setBounds(120,260,120,27);txtpass.setBounds(120,300,120,27);btok.setBounds(340,260,100,28);btexit。setBounds(340,300,100,28);add(name);add(txtname);add(pass);add(txtpass);add(btok);add(btexit);setVisible(true);btexit.add
23、ActionListener(new ActionListener()public void actionPerformed(ActionEvent e)dispose();System。exit(0););btok.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)sql=select*from 数据库用户 where 用户名=”+txtname.getText()+and密码=+txtpass。getText()+”;try rs=conu.getrs(conu.con,sql);
24、if(rs.next()mainff mf=new mainff();dispose();mf.show();else JOptionPane jop=new JOptionPane();jop.showMessageDialog(null,”用户名或密码错误,”信息提示!”,1);catch(Exception ee));addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose();System.exit(0););public void paint(Graphics g)g.se
25、tClip(new Rectangle2D.Float(0,0,500,350);g。drawImage(img,0,0,this);public class dl public static void main(String args)denglu deng=new denglu();jz。javaimport java.awt。;import java.awt.event.;import java.sql.*;import javax.swing.*;class gz extends Frame implements ActionListener,ItemListener privatec
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 人事 工资管理 系统 附录 文件 源代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内