ImageVerifierCode 换一换
格式:DOCX , 页数:36 ,大小:156.61KB ,
资源ID:7199104      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7199104.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(JAVA课程设计员工信息管理系统方案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

JAVA课程设计员工信息管理系统方案.docx

1、JAVA课程设计员工信息管理系统方案JAVA员工管理系统实验报告 姓名:* 学号:* 班级:信10-1北方工业大学理学院信息与计算科学系2013年 12月 17日员工管理系统一、实验目的通过该课程设计,使同学们进一步理解概JAVA的基本概念、理论和方法,初步掌握JDK、Eclipse的调试和应用,以及程序中错误的解决方法,明确JAVA在实际程序设计中的应用。使课堂中学习到理论得到应用,练习文件形式在JAVA程序设计中的应用。二、实验内容A.设计题目:员工管理系统 设计要求:(1)完成员工信息的添加、删除、查询、修改功能 (2)使用用户界面操作 (3)使用文件形式完成设计思路:首先设计界面进入面

2、板,在面板中添加菜单选项,并将要实现的功能选项添加其中,然后对这些选项实施监听,实现其功能。通过文件类型知识的应用,实现对员工信息的管理。B.概要设计面板设计:首先设计一个容器,然后再容器中添加菜单,在菜单中添加选项,并在容器中加入面板,面板布局设置为CardLayout,最后将面板添加进容器。功能实现:在录入、查询、修改和删除界面中使用JButton、JLabel、ButtonGroup、JRadioButton、JTextField、Choice为界面中加入相应的组件,并对其进行监听,同时附加了文件流的处理。C.详细设计1、定义员工类:public class Employee imple

3、ments java.io.Serializable String number,name,discipling,grade,borth,sex; public Employee() public void setNumber(String number) this.number=number; public String getNumber() return number; public void setName(String name) this.name=name; public String getName() return name; public void setDisciplin

4、g(String discipling) this.discipling=discipling; public String getDisciping() return discipling; public void setGrade(String grade) this.grade=grade; public String getGrade() return grade; public void setBorth(String borth) this.borth=borth; public String getBorth() return borth; public void setSex(

5、String sex) this.sex=sex; public String getSex() return sex; 2、主程序:import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.Hashtable;public class EmployeeManager extends JFrame implements ActionListener EmployeeSituation 基本信息录入=null; ModifySituation 基本信息修改=nu

6、ll; Inquest 基本信息查询=null; Delete 基本信息删除=null; JMenuBar bar; JMenu fileMenu; JMenuItem 录入,修改,查询,删除; Container con=null; Hashtable 基本信息=null; File file=null; CardLayout card=null; JLabel label=null; JPanel pCenter; public EmployeeManager() 录入=new JMenuItem(录入员工基本信息); 修改=new JMenuItem(修改员工基本信息); 查询=new

7、JMenuItem(查询员工基本信息); 删除=new JMenuItem(删除员工基本信息); bar=new JMenuBar(); fileMenu=new JMenu(菜单选项); fileMenu.add(录入); fileMenu.add(修改); fileMenu.add(查询); fileMenu.add(删除); bar.add(fileMenu); setJMenuBar(bar); label=new JLabel(欢迎进入员工信息管理系统,JLabel.CENTER); label.setFont(new Font(SansSerif,Font.BOLD+Font.IT

8、ALIC,25); label.setForeground(Color.red); 基本信息=new Hashtable(); 录入.addActionListener(this); 修改.addActionListener(this); 查询.addActionListener(this); 删除.addActionListener(this); card=new CardLayout(); con=getContentPane(); pCenter=new JPanel(); pCenter.setLayout(card); pCenter.setBackground(Color.yell

9、ow); file=new File(基本信息.txt); if(!file.exists() try FileOutputStream out=new FileOutputStream(file); ObjectOutputStream objectOut=new ObjectOutputStream(out); objectOut.writeObject(基本信息); objectOut.close(); out.close(); catch(IOException e) 基本信息录入=new EmployeeSituation(file); 基本信息修改=new ModifySituat

10、ion(file); 基本信息查询=new Inquest(this,file); 基本信息删除=new Delete(file); pCenter.add(欢迎语界面,label); pCenter.add(录入界面,基本信息录入); pCenter.add(修改界面,基本信息修改); pCenter.add(删除界面,基本信息删除); con.add(pCenter,BorderLayout.CENTER); con.validate(); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent

11、 e) System.exit(0); ); setVisible(true); setBounds(100,50,420,380); validate(); public void actionPerformed(ActionEvent e) if(e.getSource()=录入) card.show(pCenter,录入界面); else if(e.getSource()=修改) card.show(pCenter,修改界面); else if(e.getSource()=查询) 基本信息查询.setVisible(true); else if(e.getSource()=删除) car

12、d.show(pCenter,删除界面); public static void main(String args) new EmployeeManager(); 3、实现员工信息的录入:import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.*;public class EmployeeSituation extends JPanel implements ActionListener Hashtable 基本信息表=null; JTextField 员工

13、号,姓名,工资; Choice 部门; JRadioButton 男,女; Employee 员工=null; ButtonGroup group=null; JButton 录入,重置; FileInputStream inOne=null; ObjectInputStream inTwo=null; FileOutputStream outOne=null; ObjectOutputStream outTwo=null; File file=null; public EmployeeSituation(File file) this.file=file; 员工号=new JTextFiel

14、d(10); 姓名=new JTextField(10); 部门=new Choice(); 部门.add(请选择); 部门.add(研发部); 部门.add(销售部); 部门.add(人事部); 部门.add(安全部); 工资=new JTextField(10); group=new ButtonGroup(); 男=new JRadioButton(男,true); 女=new JRadioButton(女,false); group.add(男); group.add(女); 录入=new JButton(录入); 重置=new JButton(重置); 录入.addActionLis

15、tener(this); 重置.addActionListener(this); Box box1=Box.createHorizontalBox(); box1.add(new JLabel(员工号:,JLabel.CENTER); box1.add(员工号); Box box2=Box.createHorizontalBox(); box2.add(new JLabel(姓名:,JLabel.CENTER); box2.add(姓名); Box box3=Box.createHorizontalBox(); box3.add(new JLabel(性别:,JLabel.CENTER); b

16、ox3.add(男); box3.add(女); Box box4=Box.createHorizontalBox(); box4.add(new JLabel(部门:,JLabel.CENTER); box4.add(部门); Box box6=Box.createHorizontalBox(); box6.add(new JLabel( ,JLabel.CENTER); Box box5=Box.createHorizontalBox(); box5.add(new JLabel(工资:,JLabel.CENTER); box5.add(工资); Box boxH=Box.createVe

17、rticalBox(); boxH.add(box1); boxH.add(box2); boxH.add(box3); boxH.add(box5); boxH.add(box6); boxH.add(box4); boxH.add(Box.createVerticalGlue(); JPanel pCenter=new JPanel(); pCenter.add(boxH); pCenter.setBackground(Color.yellow); setLayout(new BorderLayout(); add(pCenter,BorderLayout.CENTER); JPanel

18、pSouth=new JPanel(); pSouth.add(录入); pSouth.add(重置); pSouth.setBackground(Color.yellow); add(pSouth,BorderLayout.SOUTH); validate(); public void actionPerformed(ActionEvent e) if(e.getSource()=录入) String number=; number=员工号.getText(); if(number.length()0) try inOne=new FileInputStream(file); inTwo=n

19、ew ObjectInputStream(inOne); 基本信息表=(Hashtable)inTwo.readObject(); inOne.close(); inTwo.close(); catch(Exception ee) if(基本信息表.containsKey(number) String warning=该员工基本信息已存在,请到修改页面修改!; JOptionPane.showMessageDialog(this,warning,警告,JOptionPane.WARNING_MESSAGE); else String m=基本信息将被录入!; int ok=JOptionPan

20、e.showConfirmDialog(this,m,确认,JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); if(ok=JOptionPane.YES_OPTION) String name=姓名.getText(); String discipling=部门.getSelectedItem(); String grade=工资.getText(); String sex=null; if(男.isSelected() sex=男.getText(); else sex=女.getText(); 员工=new Emplo

21、yee(); 员工.setNumber(number); 员工.setName(name); 员工.setDiscipling(discipling); 员工.setGrade(grade); 员工.setSex(sex); try outOne=new FileOutputStream(file); outTwo=new ObjectOutputStream(outOne); 基本信息表.put(number,员工); outTwo.writeObject(基本信息表); outTwo.close(); outOne.close(); 员工号.setText(null); 姓名.setTex

22、t(null); 工资.setText(null); catch(Exception ee) System.out.println(ee); else String warning=必须要输入员工号!; JOptionPane.showMessageDialog(this,warning,警告,JOptionPane.WARNING_MESSAGE); if(e.getSource()=重置) 员工号.setText(null); 姓名.setText(null); 部门.remove(部门.getSelectedIndex(); 工资.setText(null); 4、实现员工信息的修改:i

23、mport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.*;public class ModifySituation extends JPanel implements ActionListener Hashtable 基本信息表=null; JTextField 员工号,姓名,工资; Choice 部门; JRadioButton 男,女; ButtonGroup group=null; JButton 开始修改,录入修改,重置; FileInputStre

24、am inOne=null; ObjectInputStream inTwo=null; FileOutputStream outOne=null; ObjectOutputStream outTwo=null; File file=null; public ModifySituation(File file) this.file=file; 员工号=new JTextField(10); 姓名=new JTextField(10); 部门=new Choice(); 部门.add(请选择); 部门.add(研发部); 部门.add(销售部); 部门.add(人事部); 部门.add(安全部)

25、; 工资=new JTextField(10); group=new ButtonGroup(); 男=new JRadioButton(男,true); 女=new JRadioButton(女,false); group.add(男); group.add(女); 开始修改=new JButton(开始修改); 录入修改=new JButton(录入修改); 录入修改.setEnabled(false); 重置=new JButton(重置); 员工号.addActionListener(this); 开始修改.addActionListener(this); 录入修改.addAction

26、Listener(this); 重置.addActionListener(this); Box box1=Box.createHorizontalBox(); box1.add(new JLabel(输入要修改信息的员工号:,JLabel.CENTER); box1.add(员工号); box1.add(开始修改); Box box2=Box.createHorizontalBox(); box2.add(new JLabel(姓名:,JLabel.CENTER); box2.add(姓名); Box box3=Box.createHorizontalBox(); box3.add(new J

27、Label(性别:,JLabel.CENTER); box3.add(男); box3.add(女); Box box4=Box.createHorizontalBox(); box4.add(new JLabel(部门:,JLabel.CENTER); box4.add(部门); Box box6=Box.createHorizontalBox(); box6.add(new JLabel( ,JLabel.CENTER); Box box5=Box.createHorizontalBox(); box5.add(new JLabel(工资:,JLabel.CENTER); box5.add

28、(工资); Box boxH=Box.createVerticalBox(); boxH.add(box1); boxH.add(box2); boxH.add(box3); boxH.add(box5); boxH.add(box6); boxH.add(box4); boxH.add(Box.createVerticalGlue(); JPanel pCenter=new JPanel(); pCenter.add(boxH); pCenter.setBackground(Color.yellow); setLayout(new BorderLayout(); add(pCenter,BorderLayout.CENTER); JPanel pSouth=new JPanel(); pSouth.add(录入修改); p

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1