人事人事工资管理系统源代码java.docx
- 文档编号:27398461
- 上传时间:2023-06-30
- 格式:DOCX
- 页数:48
- 大小:24.55KB
人事人事工资管理系统源代码java.docx
《人事人事工资管理系统源代码java.docx》由会员分享,可在线阅读,更多相关《人事人事工资管理系统源代码java.docx(48页珍藏版)》请在冰豆网上搜索。
人事人事工资管理系统源代码java
【关键字】人事
bm.java
importjava.awt.*;
import;
importjava.sql.*;
importjavax.swing.*;
classbmextendsFrameimplementsActionListener,ItemListener
{privatecondbconx=null;
privateResultSetrs=null;
privateStringsql=null;
privateLabelnum=newLabel("职工号");
privateLabeljb=newLabel("税收");
privateLabelfj=newLabel("医疗保障");
privateLabelin=newLabel("退休保障");
privateTextFieldnumtx=newTextField();
privateTextFieldjbtx=newTextField();
privateTextFieldfjtx=newTextField();
privateTextFieldintx=newTextField();
privateChoicenumcho=newChoice();
privateButtonadd=newButton("增加");
privateButtonexit=newButton("退出");
publicbm()
{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.setBounds(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(numcho);
//lb
add.addActionListener(this);
exit.addActionListener(this);
numcho.addItemListener(this);
initnumcho();
setVisible(true);
addWindowListener(newWindowAdapter()
{publicvoidwindowClosing(WindowEvente)
{dispose();}
}
);
}
publicvoiditemStateChanged(ItemEventi)
{numtx.setText(numcho.getSelectedItem());
}
publicvoidinitnumcho()
{conx=newcondb();
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(Exceptioneo){}
}
publicvoidactionPerformed(ActionEvente)
{conx=newcondb();
if(e.getActionCommand().equals("退出"))
this.dispose();
if(e.getActionCommand().equals("增加"))
{
sql="select*from扣除工资where职工号='"+numtx.getText()+"'";
try{rs=conx.getrs(conx.con,sql);
if(rs.next())
{
sql="insertinto扣除工资(职工号,税收,医疗保险,养老保险)"+
"values('"+numtx.getText().trim()+"',"+
jbtx.getText()+","+fjtx.getText()+",'"+intx.getText()+"')";
try{;
conx.dbclose(conx.con,null);
}
catch(Exceptionue){""+ue);}
JOptionPanejop=newJOptionPane();
jop.showMessageDialog(null,"扣除工资添加成功!
","添加成功",-1);
conx.dbclose(conx.con,rs);
numtx.setText("");
jbtx.setText("");
fjtx.setText("");
conx=null;
rs=null;
}
else{JOptionPanejop=newJOptionPane();
jop.showConfirmDialog(null,"添加失败!
","警告!
",-1);
conx.dbclose(conx.con,rs);
conx=null;
rs=null;
}
}catch(SQLExceptionet){""+et);}
}
}
}
/*
else
*/
bmcx.java
importjava.awt.*;
import;
importjava.sql.*;
importjavax.swing.*;
import;
classbmcxextendsFrameimplementsActionListener
{privatecondbconc=null;
privateResultSetrs=null;
privateStringsql=null;
privateLabelchao=newLabel("职工号:
");
privateLabelcname=newLabel("姓名:
");
privateLabelcsex=newLabel("税收:
");
privateLabelcage=newLabel("医疗保险:
");
privateLabelcdep=newLabel("退休保险:
");
privateTextFieldchaotx=newTextField();
privateLabelcnametx=newLabel("");
privateLabelcsextx=newLabel("");
privateLabelcagetx=newLabel("");
privateLabelcdeptx=newLabel("");
privateButtoncx=newButton("查询");
privateButtontc=newButton("退出");
publicbmcx()
{setTitle("扣除工资查询");
setSize(400,250);
setBackground(Color.LIGHT_GRAY);
this.setLocationRelativeTo(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);
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.addActionListener(this);
addWindowListener(newWindowAdapter()
{publicvoidwindowClosing(WindowEvente)
{dispose();}
}
);
}
publicvoidactionPerformed(ActionEvente)
{if(e.getActionCommand().equals("退出"))
this.dispose();
if(e.getActionCommand().equals("查询"))
{conc=newcondb();
sql="select姓名,税收,医疗保险,退休保险from扣除工资,职工where扣除工资.职工号=职工.职工号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{JOptionPanejop=newJOptionPane();
jop.showConfirmDialog(null,"该用户不存在!
","警告",-1);
}
}
catch(Exceptionee){}
}
}
}
condb.java
importjava.sql.*;
publicclasscondb
{publicConnectioncon;//在类头定义连接对象
publiccondb()//在此构造方法中实现有关程序的加载,同时捕捉异常。
{try{Class.forName("");}//加载驱动程序
catch(e){"error");};
try{con=DriverManager.getConnection("jdbc:
odbc:
xin");}//连接数据源
catch(SQLExceptione){"connectdatabaseerror!
");}
}
publicResultSetgetrs(Connectioncon,Stringsql)//自定义查询数据库返回记录集的方法。
{ResultSetrs=null;
try{Statementstmt=con.createStatement();//创建发送sql语句的对象stmt.
rs=stmt.executeQuery(sql);//执行查询语句sql,得记录集。
}
catch(Exceptione){""+e);}
returnrs;
}
//getrs()中行参sql为实现数据库查询的查询语句,con表示数据库连接对象。
publicvoidmoddb(Connectioncon,Stringsql)
//自定义具有对数据库实现增加,删除,修改功能的方法:
{try{Statementstmt=con.createStatement();//创建发送sql语句的对象stmt.
stmt.executeUpdate(sql);//实现增加,删除,修改数据库等操作。
}
catch(Exceptione){}
}
//方法.executeUpdate()根据sql语句实现对数据库的增加,删除,修改功能。
publicvoiddbclose(Connectioncon,ResultSetrs)
//定义关闭连接对象和记录集的方法
{try{con.close();//关闭连接对象
rs.close();}//关闭记录集
catch(SQLExceptionrse){}
}
}
dl.java
importjava.awt.*;
import;
importjava.sql.*;
importjavax.swing.*;
import;
classdengluextendsFrame
{
publicLabelname=newLabel("用户名");
publicLabelpass=newLabel("密码");
publicTextFieldtxtname=newTextField();
publicTextFieldtxtpass=newTextField();
publicButtonbtok=newButton("登陆");
publicButtonbtexit=newButton("取消");
publiccondbconu=newcondb();
privateStringsql=null;
privateResultSetrs=null;
privateImageimg;
publicdenglu()
{
img=getToolkit().getImage(getClass().getResource("/ww.jpg"));
setTitle("欢迎使用工资管理系统");
setLayout(null);
setResizable(false);
setSize(500,350);
Dimensionscr=Toolkit.getDefaultToolkit().getScreenSize();
Dimensionfrm=this.getSize();
setLocation((scr.width-frm.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.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEvente){
dispose();
System.exit(0);
}});
btok.addActionListener(newActionListener()
{
publicvoidactionPerformed(ActionEvente)
{
sql="select*from数据库用户where用户名='"+txtname.getText()+"'and密码='"+txtpass.getText()+"'";
try{
rs=conu.getrs(conu.con,sql);
if(rs.next())
{mainffmf=newmainff();
dispose();
mf.show();
}
else{JOptionPanejop=newJOptionPane();
jop.showMessageDialog(null,"用户名或密码错误","信息提示!
",-1);}
}catch(Exceptionee){}
}
});
addWindowListener(newWindowAdapter()
{publicvoidwindowClosing(WindowEvente)
{dispose();
System.exit(0);
}
});
}
publicvoidpaint(Graphicsg)
{
g.setClip(newRectangle2D.Float(0,0,500,350));
g.drawImage(img,0,0,this);
}
}
publicclassdl
{publicstaticvoidmain(Stringargs[])
{dengludeng=newdenglu();
}
jz.java
importjava.awt.*;
import;
importjava.sql.*;
importjavax.swing.*;
classgzextendsFrameimplementsActionListener,ItemListener
{privatecondbconx=null;
privateResultSetrs=null;
privateStringsql=null;
privateLabelnum=newLabel("职工号");
privateLabeljb=newLabel("普通请假");
privateLabelfj=newLabel("病假");
privateLabelin=newLabel("迟到");
privateTextFieldnumtx=newTextField();
privateTextFieldjbtx=newTextField();
privateTextFieldfjtx=newTextField();
privateTextFieldintx=newTextField();
privateButtonadd=newButton("增加");
privateButtonexit=newButton("退出");
publicgz()
{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.setBounds(160,50,100,20);
jbtx.setBounds(160,80,100,20);
fjtx.setBounds(160,110,100,20);
intx.setBounds(160,140,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);
//lb
add.addActionListener(this);
exit.addActionListener(this);
setVisible(true);
addWindowListener(newWindowAdapter()
{publicvoidwindowClosing(WindowEvente)
{dispose();}
}
);
}
publicvoiditemStateChanged(ItemEventi)
{
}
publicvoidactionPerformed(ActionEvente)
{conx=newcondb();
if(e.getActionCommand().equals("退出"))
this.dispose();
if(e.getActionCommand().equals("增加"))
{
sq
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 人事 工资管理 系统 源代码 java