JAVA课程设计员工信息管理系统

上传人:m**** 文档编号:509361672 上传时间:2023-12-19 格式:DOC 页数:27 大小:227.50KB
返回 下载 相关 举报
JAVA课程设计员工信息管理系统_第1页
第1页 / 共27页
JAVA课程设计员工信息管理系统_第2页
第2页 / 共27页
JAVA课程设计员工信息管理系统_第3页
第3页 / 共27页
JAVA课程设计员工信息管理系统_第4页
第4页 / 共27页
JAVA课程设计员工信息管理系统_第5页
第5页 / 共27页
点击查看更多>>
资源描述

《JAVA课程设计员工信息管理系统》由会员分享,可在线阅读,更多相关《JAVA课程设计员工信息管理系统(27页珍藏版)》请在金锄头文库上搜索。

1、JAVA员工管理系统实验报告 姓名:张旭冉 学号:10105010117 班级:信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 implements

3、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 setDiscipling(Stri

4、ng 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(String

5、 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 ActionListenerEmployeeSituation 基本信息录入=null; ModifySituation 基本信息修改=null; Inq

6、uest 基本信息查询=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 JMenuIt

7、em(查询员工基本信息); 删除=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.ITALIC,25

8、); 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.yellow); fi

9、le=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 ModifySituation(fil

10、e); 基本信息查询=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 e) Sys

11、tem.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()=删除) card.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 基

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 建筑资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号