《数据库应用》课程设计人事管理系统java源代码文档格式.docx
《《数据库应用》课程设计人事管理系统java源代码文档格式.docx》由会员分享,可在线阅读,更多相关《《数据库应用》课程设计人事管理系统java源代码文档格式.docx(127页珍藏版)》请在冰点文库上搜索。
con.setLayout(null);
label.setBounds(95,10,110,20);
label.setFont(newFont("
Font.PLAIN,14));
con.add(label);
labelName.setBounds(45,40,55,20);
labelName.setFont(f);
con.add(labelName);
textName.setBounds(95,40,120,20);
con.add(textName);
labelage.setBounds(45,70,45,20);
con.add(labelage);
labelage.setFont(f);
textage.setBounds(95,70,120,20);
con.add(textage);
buttonEnter.setBounds(90,110,60,20);
buttonEnter.setFont(f);
con.add(buttonEnter);
//登陆的鼠标监听
buttonEnter.addMouseListener(newMouseAdapter(){
publicvoidmouseClicked(MouseEventme){
if(textName.getText().equals("
)){
newJOptionPane().showMessageDialog(null,"
用户名不能为空!
}
elseif(textage.getText().equals("
密码不能为空!
else{
Stringsql="
select*fromUserInformationwhereUser_Name='
+textName.getText()+"
'
andPassword='
+textage.getText()+"
;
System.out.println(sql);
Judge(sql);
});
buttoncancel.setBounds(155,110,60,20);
buttoncancel.setFont(f);
con.add(buttoncancel);
//清空按钮的鼠标监听方法
buttoncancel.addMouseListener(newMouseAdapter(){
textName.setText("
textage.setText("
setResizable(false);
Imageimg=Toolkit.getDefaultToolkit().getImage("
image\\main.gif"
setIconImage(img);
Toolkitt=Toolkit.getDefaultToolkit();
intw=t.getScreenSize().width;
inth=t.getScreenSize().height;
setBounds(w/2-150,h/2-90,300,180);
setVisible(true);
privatevoidJudge(StringsqlString){
if(Database.joinDB()){
if(Database.query(sqlString))
try{
if(Database.rs.isBeforeFirst()){
System.out.println("
密码正确"
jf.setVisible(false);
D.close();
newMain();
else{
错误"
用户名或密码错
误!
"
JOptionPane.ERROR_MESSAGE);
}catch(Exceptionex){
System.out.println(ex.getMessage());
连接数据库不成功"
publicstaticvoidmain(Stringargs[]){
newLand();
//主函数类,可以独立运行
publicclassMainextendsJFrameimplementsRunnable{
Threadt=newThread(this);
JDesktopPanedeskpane=newJDesktopPane();
JPanelp=newJPanel();
Labellp1=newLabel("
欢迎使用员工管理系统!
ImageIconicon1=newImageIcon("
imagetjsc.gif"
ImageIconicon2=newImageIcon("
imagecxdl.gif"
ImageIconicon3=newImageIcon("
imagexgmm.gif"
ImageIconicon4=newImageIcon("
imagetcxt.gif"
ImageIconicon5=newImageIcon("
imagejj.gif"
ImageIconicon6=newImageIcon("
imagehelp.gif"
ImageIconicon7=newImageIcon("
imagecx.gif"
ImageIconicon8=newImageIcon("
imagegl.gif"
ImageIconicon9=newImageIcon("
imagext.gif"
ImageIconicon10=newImageIcon("
imagexxgl.gif"
ImageIconicon11=newImageIcon("
imagexxcx.gif"
ImageIconicon12=newImageIcon("
imagebz.gif"
ImageIconicon13=newImageIcon("
imagegy.gif"
ImageIconicon14=newImageIcon("
imageglxx.gif"
ImageIconicon15=newImageIcon("
imagecxxx.gif"
//完
--------------------------------------------------------------------------------
publicMain(){
con.setLayout(newBorderLayout());
con.add(deskpane,BorderLayout.CENTER);
Fontf=newFont("
JMenuBarmb=newJMenuBar();
JMenusystemM=newJMenu("
系统管理"
systemM.setFont(f);
JMenumanageM=newJMenu("
信息管理"
manageM.setFont(f);
JMenuemployeeMM=newJMenu("
员工信息管理"
employeeMM.setFont(f);
JMenuselectM=newJMenu("
信息查询"
selectM.setFont(f);
JMenuemployeeSM=newJMenu("
员工信息查询"
employeeSM.setFont(f);
JMenuhelpM=newJMenu("
帮助"
helpM.setFont(f);
JMenuaboutM=newJMenu("
关于"
aboutM.setFont(f);
JMenuItempassword=newJMenuItem("
密码修改"
password.setFont(f);
JMenuItemland=newJMenuItem("
重新登陆"
land.setFont(f);
JMenuItemaddDelete=newJMenuItem("
添加/删除用户"
addDelete.setFont(f);
JMenuItemexit=newJMenuItem("
退出系统"
exit.setFont(f);
systemM.add(password);
systemM.add(land);
systemM.add(addDelete);
systemM.add(exit);
//为系统管理菜单加事件
password.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEvente){
AmendPassword"
deskpane.add(newAmendPassword());
land.addActionListener(newActionListener(){
Land"
setVisible(false);
addDelete.addActionListener(newActionListener(){
deskpane.add(newAddDeleteUser());
exit.addActionListener(newActionListener(){
//newJOptionPane().showMessageDialog(
JMenuItemdepartmentM=newJMenuItem("
部门信息管理"
departmentM.setFont(f);
JMenuItememployeeM=newJMenuItem("
基本信息管理"
employeeM.setFont(f);
JMenuItemtrainM=newJMenuItem("
培训信息管理"
trainM.setFont(f);
JMenuItemencouragementPunishM=newJMenuItem("
奖罚信息管理"
encouragementPunishM.setFont(f);
JMenuItemwageM=newJMenuItem("
薪资信息管理"
wageM.setFont(f);
employeeMM.add(trainM);
employeeMM.add(employeeM);
employeeMM.add(encouragementPunishM);
employeeMM.add(wageM);
manageM.add(employeeMM);
manageM.add(departmentM);
//为管理菜单加事件
departmentM.addActionListener(newActionListener(){
Departmentmanage"
deskpane.add(newDepartmentmanage());
employeeM.addActionListener(newActionListener(){
Employeemanage"
deskpane.add(newEmployeemanage());
trainM.addActionListener(newActionListener(){
Trainmanage"
deskpane.add(newTrainmanage());
encouragementPunishM.addActionListener(newActionListener(){
EncouragementPunish"
deskpane.add(newEncouragementPunish());
wageM.addActionListener(newActionListener(){
WageManage"
deskpane.add(newWageManage());
JMenuItemdepartmentS=newJMenuItem("
部门信息查询"
departmentS.setFont(f);
JMenuItememployeeS=newJMenuItem("
基本信息查询"
employeeS.setFont(f);
JMenuItemtrainS=newJMenuItem("
培训信息查询"
trainS.setFont(f);
JMenuItemencouragementPunishS=newJMenuItem("
奖罚信息查询"
encouragementPunishS.setFont(f);
JMenuItemwageS=newJMenuItem("
薪资信息查询"
wageS.setFont(f);
employeeSM.add(trainS);
employeeSM.add(employeeS);
employeeSM.add(encouragementPunishS);
employeeSM.add(wageS);
selectM.add(employeeSM);
selectM.add(departmentS);
//为查询菜单加事件
departmentS.addActionListener(newActionListener(){
DIQ"
deskpane.add(newDIQ());
employeeS.addActionListener(newActionListener(){
BIQ"
deskpane.add(newBIQ());
trainS.addActionListener(newActionListener(){
TIQ"
deskpane.add(newTIQ());
encouragementPunishS.addActionListener(newActionListener(){
EPIQ"
deskpane.add(newEPIQ());
wageS.addActionListener(newActionListener(){
SIQ"
deskpane.add(newSIQ());
JMenuItemhelp=newJMenuItem("
help.setFont(f);
JMenuItemabout=newJMenuItem("
about.setFont(f);
helpM.add(help);
aboutM.add(about);
//为帮助菜单加事件
about.addActionListener(newActionListener(){
deskpane.add(newAbout());
mb.add(systemM);
mb.add(manageM);
mb.add(selectM);
mb.add(helpM);
mb.add(aboutM);
setJMenuBar(mb);
imagemain.gif"
systemM.setIcon(icon9);
manageM.setIcon(icon8);
selectM.setIcon(icon7);
helpM.setIcon(icon6);
addDelete.setIcon(icon1);
land.setIcon(icon2);
password.setIcon(icon3);
exit.setIcon(icon4);
employeeMM.setIcon(icon5);
employeeSM.setIcon(icon5);
departmentM.setIcon(icon10);
departmentS.setIcon(icon11);
help.setIcon(icon6);
aboutM.setIcon(icon13);
about.setIcon(icon13);
employeeM.setIcon(icon14);
trainM.setIcon(icon14);
encouragementPunishM.setIcon(icon14);
wageM.setIcon(icon14);
employeeS.setIcon(icon15);
trainS.setIcon(icon15);
encouragementPunishS.setIcon(icon15);
wageS.setIcon(icon15);
JToolBarjToolBar1=newJToolBar();
jToolBar1.setLayout(newGridLayout(9,1));
JButtonjButton1=newJButton();
jButton1.setToolTipText("
员工基本信息管理"
JButtonjButton2=newJButton();
jButton2.setToolTipText("
员工基本信息查询"
JButtonjButton3=newJButton();
jButton3.setToolTipText("
修改密码"
JButtonjButton5=newJButton();
jButton5.setToolTipText("
计算器"
JButtonjButton6