JAVA课程设计员工信息管理系统Word下载.docx

上传人:b****1 文档编号:3830586 上传时间:2023-05-02 格式:DOCX 页数:42 大小:158.42KB
下载 相关 举报
JAVA课程设计员工信息管理系统Word下载.docx_第1页
第1页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第2页
第2页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第3页
第3页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第4页
第4页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第5页
第5页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第6页
第6页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第7页
第7页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第8页
第8页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第9页
第9页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第10页
第10页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第11页
第11页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第12页
第12页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第13页
第13页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第14页
第14页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第15页
第15页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第16页
第16页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第17页
第17页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第18页
第18页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第19页
第19页 / 共42页
JAVA课程设计员工信息管理系统Word下载.docx_第20页
第20页 / 共42页
亲,该文档总共42页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

JAVA课程设计员工信息管理系统Word下载.docx

《JAVA课程设计员工信息管理系统Word下载.docx》由会员分享,可在线阅读,更多相关《JAVA课程设计员工信息管理系统Word下载.docx(42页珍藏版)》请在冰点文库上搜索。

JAVA课程设计员工信息管理系统Word下载.docx

this。

name=name;

publicStringgetName()

returnname;

publicvoidsetDiscipling(Stringdiscipling)

this.discipling=discipling;

publicStringgetDisciping()

returndiscipling;

publicvoidsetGrade(Stringgrade)

grade=grade;

publicStringgetGrade()

returngrade;

publicvoidsetBorth(Stringborth)

this.borth=borth;

publicStringgetBorth()

returnborth;

publicvoidsetSex(Stringsex)

this.sex=sex;

publicStringgetSex()

returnsex;

}}

2、主程序:

importjava。

awt。

*;

event.*;

importjavax.swing。

*;

importjava.io。

util。

Hashtable;

publicclassEmployeeManagerextendsJFrameimplementsActionListener

EmployeeSituation基本信息录入=null;

ModifySituation基本信息修改=null;

Inquest基本信息查询=null;

Delete基本信息删除=null;

JMenuBarbar;

JMenufileMenu;

JMenuItem录入,修改,查询,删除;

Containercon=null;

Hashtable基本信息=null;

Filefile=null;

CardLayoutcard=null;

JLabellabel=null;

JPanelpCenter;

publicEmployeeManager()

录入=newJMenuItem(”录入员工基本信息"

);

修改=newJMenuItem("

修改员工基本信息"

);

查询=newJMenuItem("

查询员工基本信息”);

删除=newJMenuItem(”删除员工基本信息"

bar=newJMenuBar();

fileMenu=newJMenu("

菜单选项”);

fileMenu.add(录入);

fileMenu。

add(修改);

add(查询);

add(删除);

bar。

add(fileMenu);

setJMenuBar(bar);

label=newJLabel(”欢迎进入员工信息管理系统”,JLabel.CENTER);

label。

setFont(newFont("

SansSerif”,Font.BOLD+Font.ITALIC,25));

setForeground(Color.red);

基本信息=newHashtable();

录入.addActionListener(this);

修改。

addActionListener(this);

查询。

删除。

addActionListener(this);

card=newCardLayout();

con=getContentPane();

pCenter=newJPanel();

pCenter.setLayout(card);

pCenter.setBackground(Color.yellow);

file=newFile(”基本信息.txt”);

if(!

file.exists())

{

try

FileOutputStreamout=newFileOutputStream(file);

ObjectOutputStreamobjectOut=newObjectOutputStream(out);

objectOut。

writeObject(基本信息);

objectOut.close();

out.close();

}

catch(IOExceptione)

{

}

基本信息录入=newEmployeeSituation(file);

基本信息修改=newModifySituation(file);

基本信息查询=newInquest(this,file);

基本信息删除=newDelete(file);

pCenter.add(”欢迎语界面"

,label);

pCenter。

add("

录入界面"

,基本信息录入);

pCenter.add("

修改界面”,基本信息修改);

删除界面”,基本信息删除);

con。

add(pCenter,BorderLayout.CENTER);

validate();

addWindowListener(newWindowAdapter()

publicvoidwindowClosing(WindowEvente)

System.exit(0);

}});

setVisible(true);

setBounds(100,50,420,380);

validate();

}

publicvoidactionPerformed(ActionEvente)

if(e.getSource()==录入)

card.show(pCenter,”录入界面”);

elseif(e.getSource()==修改)

card.show(pCenter,"

修改界面”);

elseif(e.getSource()==查询)

基本信息查询。

setVisible(true);

elseif(e.getSource()==删除)

card.show(pCenter,"

删除界面"

publicstaticvoidmain(Stringargs[])

newEmployeeManager();

}}

3、实现员工信息的录入:

awt.*;

awt.event.*;

importjavax。

swing.*;

io。

*;

publicclassEmployeeSituationextendsJPanelimplementsActionListener

Hashtable基本信息表=null;

JTextField员工号,姓名,工资;

Choice部门;

JRadioButton男,女;

Employee员工=null;

ButtonGroupgroup=null;

JButton录入,重置;

FileInputStreaminOne=null;

ObjectInputStreaminTwo=null;

FileOutputStreamoutOne=null;

ObjectOutputStreamoutTwo=null;

Filefile=null;

publicEmployeeSituation(Filefile)

{

this.file=file;

员工号=newJTextField(10);

姓名=newJTextField(10);

部门=newChoice();

部门.add(”请选择"

部门。

研发部”);

销售部"

人事部"

部门.add(”安全部"

工资=newJTextField(10);

group=newButtonGroup();

男=newJRadioButton(”男”,true);

女=newJRadioButton(”女"

,false);

group.add(男);

group。

add(女);

录入=newJButton("

录入"

重置=newJButton("

重置”);

录入.addActionListener(this);

重置.addActionListener(this);

Boxbox1=Box。

createHorizontalBox();

box1。

add(newJLabel(”员工号:

"

,JLabel。

CENTER));

box1.add(员工号);

Boxbox2=Box。

createHorizontalBox();

box2.add(newJLabel("

姓名:

”,JLabel。

CENTER));

box2。

add(姓名);

Boxbox3=Box。

box3。

add(newJLabel("

性别:

,JLabel.CENTER));

box3.add(男);

box3.add(女);

Boxbox4=Box。

box4.add(newJLabel(”部门:

box4。

add(部门);

Boxbox6=Box.createHorizontalBox();

box6.add(newJLabel("

"

Boxbox5=Box.createHorizontalBox();

box5.add(newJLabel(”工资:

box5.add(工资);

BoxboxH=Box。

createVerticalBox();

boxH。

add(box1);

boxH.add(box2);

add(box3);

add(box5);

boxH.add(box6);

add(box4);

boxH.add(Box.createVerticalGlue());

JPanelpCenter=newJPanel();

pCenter.add(boxH);

pCenter。

setBackground(Color.yellow);

setLayout(newBorderLayout());

add(pCenter,BorderLayout.CENTER);

JPanelpSouth=newJPanel();

pSouth.add(录入);

pSouth.add(重置);

pSouth。

setBackground(Color.yellow);

add(pSouth,BorderLayout.SOUTH);

validate();

publicvoidactionPerformed(ActionEvente)

if(e。

getSource()==录入)

Stringnumber="

”;

number=员工号。

getText();

if(number。

length()〉0)

try

inOne=newFileInputStream(file);

inTwo=newObjectInputStream(inOne);

基本信息表=(Hashtable)inTwo。

readObject();

inOne.close();

inTwo.close();

catch(Exceptionee)

if(基本信息表.containsKey(number))

Stringwarning=”该员工基本信息已存在,请到修改页面修改!

JOptionPane.showMessageDialog(this,warning,"

警告”,JOptionPane。

WARNING_MESSAGE);

else

{

Stringm="

基本信息将被录入!

intok=JOptionPane.showConfirmDialog(this,m,”确认"

JOptionPane。

YES_NO_OPTION,

JOptionPane.INFORMATION_MESSAGE);

if(ok==JOptionPane。

YES_OPTION)

Stringname=姓名。

getText();

Stringdiscipling=部门.getSelectedItem();

Stringgrade=工资。

Stringsex=null;

if(男。

isSelected())

sex=男.getText();

sex=女.getText();

员工=newEmployee();

员工。

setNumber(number);

员工.setName(name);

员工.setDiscipling(discipling);

setGrade(grade);

员工.setSex(sex);

try

outOne=newFileOutputStream(file);

outTwo=newObjectOutputStream(outOne);

基本信息表。

put(number,员工);

outTwo。

writeObject(基本信息表);

close();

outOne。

close();

员工号。

setText(null);

姓名。

setText(null);

工资.setText(null);

System。

out。

println(ee);

}}}}

else

Stringwarning="

必须要输入员工号!

JOptionPane。

showMessageDialog(this,warning,"

警告”,JOptionPane。

}}

if(e。

getSource()==重置)

{

员工号。

姓名。

部门.remove(部门。

getSelectedIndex());

工资。

}}}

4、实现员工信息的修改:

importjava.awt.*;

importjava.awt。

event.*;

importjavax.swing.*;

importjava.io.*;

importjava.util。

publicclassModifySituationextendsJPanelimplementsActionListener

Hashtable基本信息表=null;

JTextField员工号,姓名,工资;

Choice部门;

JRadioButton男,女;

ButtonGroupgroup=null;

JButton开始修改,录入修改,重置;

FileInputStreaminOne=null;

ObjectInputStreaminTwo=null;

FileOutputStreamoutOne=null;

ObjectOutputStreamoutTwo=null;

Filefile=null;

publicModifySituation(Filefile)

this.file=file;

员工号=newJTextField(10);

姓名=newJTextField(10);

部门=newChoice();

部门.add(”请选择”);

部门.add(”研发部"

部门.add(”销售部”);

部门。

部门.add(”安全部”);

工资=newJTextField(10);

group=newButtonGroup();

男=newJRadioButton(”男”,true);

女=newJRadioButton(”女"

,false);

group.add(男);

group.add(女);

开始修改=newJButton("

开始修改”);

录入修改=newJButton("

录入修改"

录入修改。

setEnabled(false);

重置=newJButton(”重置"

员工号.addActionListener(this);

开始修改。

录入修改.addActionListener(this);

重置.addActionListener(this);

Boxbox1=Box。

box1.add(newJLabel("

输入要修改信息的员工号:

”,JLabel。

box1。

add(员工号);

add(开始修改);

Boxbox2=Box.createHorizontalBox();

box2。

Boxbox3=Box。

box3。

add(newJLabel(”性别:

”,JLabel.CENTER));

box3.add(男);

box3.add(女);

Boxbox4=Box.createHorizontalBox();

box4。

部门:

JLabel。

box4.add(部门);

Boxbox6=Box.createHorizontalBox();

box6。

Boxbox5=Box.createHorizontalBox();

box5.add(newJLabel(”工资:

box5.add(工资);

BoxboxH=Box。

boxH.add(box1);

boxH。

add(box2);

add(box3);

boxH.add(box5);

boxH.add(box6);

boxH.add(box4);

boxH.add(Box。

createVerticalGlue());

JPanelpCenter=newJPanel();

pCenter.add(boxH);

setBackground(Color。

yellow);

setLayout(newBorderLayout());

add(pCenter,BorderLayout。

CENTER);

JPanelpSouth=newJPanel();

pSouth。

add(录入修改);

pSo

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2