数据库工资管理系统报告和代码大全 下载本文

private JMenuItem emp_del=new JMenuItem(\删除员工\ /*创建工资菜单项*/

private JMenu menuwage=new JMenu(\员工工资信息管理\

private JMenuItem wage_insert=new JMenuItem(\添加新工资信息\ private JMenuItem wage_update=new JMenuItem(\更新工资信息\ private JMenuItem wage_del=new JMenuItem(\删除员工工资信息\ /*创建统计菜单项*/

private JMenu menustat=new JMenu(\查询汇总——部门、员工、员工工资信息\ private JMenuItem merge=new JMenuItem(\汇总部门年份工资总额信息及人数\ private JMenuItem search=new JMenuItem(\查询部门和员工基本信息及工资明细\ WageMain(){

JPanel jp =(JPanel)this.getContentPane(); jp.setLayout(new BorderLayout());

JPanel jp1=new JPanel(new FlowLayout());

jp.add(ch20081798);ch20081798.setEditable(false); jp1.add(btn_quit);

jp.add(jp1,BorderLayout.SOUTH); menudept.add(dept_insert); menudept.add(dept_update); menudept.add(dept_del); menuemp.add(emp_insert); menuemp.add(emp_update); menuemp.add(emp_del); menuwage.add(wage_insert); menuwage.add(wage_update); menuwage.add(wage_del); menustat.add(merge); menustat.add(search); mainMune.add(menudept); mainMune.add(menuemp); mainMune.add(menuwage); mainMune.add(menustat); this.setJMenuBar(mainMune);

dept_insert.addActionListener(this); dept_update.addActionListener(this); dept_del.addActionListener(this); emp_insert.addActionListener(this); emp_update.addActionListener(this); emp_del.addActionListener(this); wage_insert.addActionListener(this); wage_update.addActionListener(this); wage_del.addActionListener(this); merge.addActionListener(this); search.addActionListener(this);

btn_quit.addActionListener(this); this.setSize(570, 300); this.setVisible(true);

this.setLocation(350, 220); this.setTitle(\工资管理系统\

this.setResizable(false);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }

public void actionPerformed(ActionEvent e) { if (e.getSource()==dept_insert){

DeptInsert deptinsert=new DeptInsert();this.dispose(); }else if (e.getSource()==dept_update){

DeptUpdate deptipdate=new DeptUpdate();this.dispose(); }else if (e.getSource()==dept_del){

DeptDel deptdel=new DeptDel();this.dispose(); }else if (e.getSource()==emp_insert){

EmpInsert empinsert=new EmpInsert();this.dispose(); }else if (e.getSource()==emp_update){

EmpUpdate empupdate=new EmpUpdate();this.dispose(); }else if (e.getSource()==emp_del){

EmpDel empdel=new EmpDel();this.dispose(); }else if (e.getSource()==wage_insert){

WageInsert wageinsert=new WageInsert();this.dispose(); }else if (e.getSource()==wage_update){

WageUpdate wageupdate=new WageUpdate();this.dispose(); }else if (e.getSource()==wage_del){

WageDel wagedel=new WageDel();this.dispose(); }else if (e.getSource()==merge){

Merge merge=new Merge();this.dispose(); }else if (e.getSource()==search){

Search search=new Search();this.dispose(); }else if (e.getSource()==btn_quit){

LandFrame landfrm=new LandFrame();this.dispose(); } } }

/*部门添加界面类*/

package WageMangement; import java.awt.*;

import java.awt.event.*; import javax.swing.*;

public class DeptInsert extends JFrame implements ActionListener{ private JLabel lbl_dno= new JLabel(\新增部门编号(7位数字)\

private JLabel lbl_dname= new JLabel(\新增部门名称(至多20字符)\

private JLabel lbl_principal = new JLabel(\新增部门负责人(至多10字符)\ private JTextField txt_dno = new JTextField(); private JTextField txt_dname= new JTextField(); private JTextField txt_principal = new JTextField(); private JButton btn_insert=new JButton(\确认添加\ private JButton btn_back=new JButton(\返回\

private WageDao wagedao=new WageDao(); DeptInsert(){

JPanel jp=(JPanel)this.getContentPane(); jp.setLayout(new BorderLayout());

JPanel jp1=new JPanel(new GridLayout(3,2,5,8));

jp1.setBorder(BorderFactory.createTitledBorder(\添加部门\

jp1.add(lbl_dno);jp1.add(txt_dno);

jp1.add(lbl_dname);jp1.add(txt_dname); jp1.add(lbl_principal);jp1.add(txt_principal);

JPanel jp2=new JPanel(new GridLayout(1,2,10,10));

jp2.setBorder(BorderFactory.createTitledBorder(\作者:杜舒静 学号:20081798\ jp2.add(btn_insert);jp2.add(btn_back); jp.add(jp1,BorderLayout.NORTH); jp.add(jp2,BorderLayout.SOUTH); this.setSize(343, 190); this.setVisible(true);

this.setLocation(500, 280); this.setTitle(\工资管理系统\

this.setResizable(false);

btn_insert.addActionListener(this); btn_back.addActionListener(this);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }

public void actionPerformed(ActionEvent e) { if(e.getSource()==btn_insert){ System.out.println(\ wagedao.deptInsert( this, txt_dno.getText().trim(), txt_dname.getText().trim(), txt_principal.getText().trim() );

}else if (e.getSource()==btn_back){

WageMain wageMain=new WageMain();this.dispose(); } } }

/*部门信息修改类*/ package WageMangement;

import java.awt.*;

import java.awt.event.*; import javax.swing.*;

public class DeptUpdate extends JFrame implements ActionListener { private JComboBox txt_dept= new JComboBox(); private JLabel empty=new JLabel();

private JLabel input=new JLabel(\需更新的部门:\ private JLabel empty_2=new JLabel(\原部门信息\ private JLabel empty_3=new JLabel(\新部门信息\ private JLabel lbl_dno=new JLabel(\部门编号\ private JLabel lbl_dname=new JLabel(\部门名称\

private JLabel lbl_principal =new JLabel(\部门负责人\ private JTextField txt_old_dno=new JTextField(); private JTextField txt_old_dname=new JTextField(); private JTextField txt_old_principal=new JTextField(); private JTextField txt_new_dno=new JTextField(); private JTextField txt_new_dname=new JTextField(); private JTextField txt_new_principal=new JTextField(); private JButton btn_query=new JButton(\查询\ private JButton btn_update=new JButton(\更新\ private JButton btn_back=new JButton(\返回\

private WageDao dao= new WageDao();

public void writeOldTxt(String one,String two,String three){ txt_old_dno.setText(one); txt_old_dname.setText(two); txt_old_principal.setText(three); }

public void setItem(){

dao.getDeptItem(txt_dept); }

DeptUpdate(){

JPanel jp =(JPanel)this.getContentPane(); jp.setLayout(new BorderLayout());

jp.setBorder(BorderFactory.createTitledBorder(\更新部门\ this.setItem();

JPanel jp1=new JPanel(new BorderLayout()); JPanel jp2=new JPanel(new GridLayout(5,2,5,5)); JPanel jp3=new JPanel(new GridLayout(5,1,3,5)); JPanel jp4=new JPanel(new BorderLayout());

jp4.setBorder(BorderFactory.createTitledBorder(\ JPanel jp5=new JPanel(new GridLayout(1,2,8,8)); txt_old_dno.setEditable(false); txt_old_dname.setEditable(false); txt_old_principal.setEditable(false);