⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 managerframe.java~121~

📁 本员工管理系统使公司员工能通过网络来查询信息、请假
💻 JAVA~121~
字号:
package employeemanagersystem;

import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import javax.swing.Box;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.awt.Font;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class ManagerFrame
    extends JFrame
{

  public ManagerFrame()
  {
    try
    {
      jbInit();
    }
    catch (Exception exception)
    {
      exception.printStackTrace();
    }
  }

  private void jbInit()
      throws Exception
  {
    getContentPane().setLayout(null);
    SQLClass mySql = new SQLClass();
    Date dt = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("dd");
    SimpleDateFormat sdfYear = new SimpleDateFormat("MM");
    //System.out.println(sdf.format(dt));
    if (sdf.format(dt).equals("01"))
    {
      mySql.insertCheckItems();
    }
    if (sdf.format(dt).equals("28"))
    {
      mySql.insertSalaryItems(dt);
    }
    if (sdfYear.format(dt).equals("12"))
    {
      mySql.insertBonusItems(dt);
    }
    this.getContentPane().setBackground(UIManager.getColor("control"));
    this.setSize(1100, 750);
    this.setJMenuBar(MenuBar1);
    this.setTitle("员工管理系统1.0正式版     系统管理员——" + li.getLogName() + " 在线");
    ToolBar.setBorder(BorderFactory.createEtchedBorder());
    ToolBar.setToolTipText("");
    ToolBar.setBounds(new Rectangle( -1, 0, 273, 34));

    empEditIcon = new ImageIcon(".//pictures//empEdit.gif");
    employeeEditButton.setToolTipText("管理员工的信息");
    //employeeEditButton.setText("管理员工");
    employeeEditButton.setIcon(empEditIcon);
    employeeEditButton.addActionListener(new
                                         ManagerFrame_employeeEditButton_actionAdapter(this));
    salaryIcon = new ImageIcon(".//pictures//salary.gif");
    //showSalaryButton.setText("显示员工薪水");
    showSalaryButton.setBorder(null);
    showSalaryButton.setToolTipText("查询员工的薪水");
    showSalaryButton.setIcon(salaryIcon);
    showSalaryButton.addActionListener(new
                                       ManagerFrame_showSalaryButton_actionAdapter(this));

    bonusIcon = new ImageIcon(".//pictures//bonus.gif");
    showBonusButton.setToolTipText("显示员工的年终奖金");
    //showBonusButton.setText("显示员工年奖金");
    showBonusButton.setIcon(bonusIcon);
    showBonusButton.addActionListener(new
                                      ManagerFrame_showBonusButton_actionAdapter(this));

    leaveIcon = new ImageIcon(".//pictures//leave.gif");
    leaveButton.setToolTipText("请假管理");
    //leaveButton.setText("请假");
    leaveButton.setIcon(leaveIcon);
    leaveButton.addActionListener(new ManagerFrame_leaveButton_actionAdapter(this));

    exhibitionIcon = new ImageIcon(".//pictures//exhibition.gif");
    piup.setBackground(SystemColor.control);
    piup.setBorder(BorderFactory.createEtchedBorder());

    piup.setBounds(new Rectangle(13, 68, 1006, 584));
    systemMenu.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
    systemMenu.setText("系统设置");
    addDepMenuItem.setText("添加部门");
    addJobMenuItem.setText("添加工种");
    selectMenu.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
    selectMenu.setText("查看");
    selectDepInforMenuItem.setText("部门信息");
    selectJobInforMenuItem.setText("工种信息");
    selectEmpInforMenu.setText("员工信息");
    selectByEmpIdMenuItem.setText("按编号查询");
    selectByEmpIdMenuItem.addItemListener(new
                                          ManagerFrame_selectByEmpIdMenuItem_itemAdapter(this));
    selectByEmpNameMenuItem.setText("按姓名查询");
    selectByEmpNameMenuItem.addItemListener(new
                                            ManagerFrame_selectByEmpNameMenuItem_itemAdapter(this));
    selectByEmpDepMenuItem.setText("按部门查询");
    selectByEmpDepMenuItem.addItemListener(new
                                           ManagerFrame_selectByEmpDepMenuItem_itemAdapter(this));
    selectByEmpJobMenuItem.setText("按工种查询");
    selectByEmpJobMenuItem.addItemListener(new
                                           ManagerFrame_selectByEmpJobMenuItem_itemAdapter(this));
    aboutMenu.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
    aboutMenu.setText("关于..");
    helpMenuItem.setText("帮助");
    aboutMenuItem.setText("关于");
    noticeLabel.setText("您的个人信息如下,您可以进行有关修改");
    noticeLabel.setBounds(new Rectangle(22, 36, 418, 28));
    jLabel1.setText("|");
    exitMenu.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
    exitMenu.setText("退出");
    jMenuItem1.setText("返回到登录页面");
    jMenuItem1.addActionListener(new ManagerFrame_jMenuItem1_actionAdapter(this));
    jLabel2.setText("|");
    jLabel3.setText("|");
    selectAllMenuItem.setText("查询所有");
    selectAllMenuItem.addItemListener(new
                                      ManagerFrame_selectAllMenuItem_itemAdapter(this));

    ToolBar.add(employeeEditButton);
    ToolBar.add(jLabel2);
    ToolBar.add(showSalaryButton);
    ToolBar.add(jLabel3);
    ToolBar.add(showBonusButton);
    ToolBar.add(jLabel1);
    ToolBar.add(leaveButton);
    this.getContentPane().add(noticeLabel);
    this.getContentPane().add(piup);
    this.getContentPane().add(ToolBar);
    MenuBar1.add(systemMenu);
    MenuBar1.add(selectMenu);
    MenuBar1.add(aboutMenu);
    MenuBar1.add(exitMenu);
    systemMenu.add(addDepMenuItem);
    systemMenu.add(addJobMenuItem);
    selectMenu.add(selectEmpInforMenu);
    selectMenu.addSeparator();
    selectMenu.add(selectDepInforMenuItem);
    selectMenu.addSeparator();
    selectMenu.add(selectJobInforMenuItem);
    selectEmpInforMenu.add(selectByEmpIdMenuItem);
    selectEmpInforMenu.add(selectByEmpNameMenuItem);
    selectEmpInforMenu.add(selectByEmpDepMenuItem);
    selectEmpInforMenu.add(selectByEmpJobMenuItem);
    selectEmpInforMenu.add(selectAllMenuItem);
    aboutMenu.add(helpMenuItem);
    aboutMenu.addSeparator();
    aboutMenu.add(aboutMenuItem);
    exitMenu.add(jMenuItem1);
  }

  LoginInformation li = new LoginInformation();
  ImageIcon empEditIcon = new ImageIcon();
  ImageIcon salaryIcon = new ImageIcon();
  ImageIcon bonusIcon = new ImageIcon();
  ImageIcon leaveIcon = new ImageIcon();
  ImageIcon exhibitionIcon = new ImageIcon();
  PersonalInforUpdatePanel piup = new PersonalInforUpdatePanel();
  JToolBar ToolBar = new JToolBar();
  JButton showSalaryButton = new JButton();
  JButton showBonusButton = new JButton();
  JButton leaveButton = new JButton();
  JMenuBar MenuBar1 = new JMenuBar();
  JMenu systemMenu = new JMenu();
  JMenuItem addDepMenuItem = new JMenuItem();
  JMenuItem addJobMenuItem = new JMenuItem();
  JMenu selectMenu = new JMenu();
  JMenuItem selectDepInforMenuItem = new JMenuItem();
  JMenuItem selectJobInforMenuItem = new JMenuItem();
  JMenu selectEmpInforMenu = new JMenu();
  JRadioButtonMenuItem selectByEmpIdMenuItem = new JRadioButtonMenuItem();
  JRadioButtonMenuItem selectByEmpNameMenuItem = new JRadioButtonMenuItem();
  JRadioButtonMenuItem selectByEmpDepMenuItem = new JRadioButtonMenuItem();
  JRadioButtonMenuItem selectByEmpJobMenuItem = new JRadioButtonMenuItem();
  JRadioButtonMenuItem selectAllMenuItem = new JRadioButtonMenuItem();
  JMenu aboutMenu = new JMenu();
  JMenuItem helpMenuItem = new JMenuItem();
  JMenuItem aboutMenuItem = new JMenuItem();
  JLabel noticeLabel = new JLabel();
  TitledBorder titledBorder1 = new TitledBorder("");
  JLabel jLabel1 = new JLabel();
  JMenu exitMenu = new JMenu();
  JMenuItem jMenuItem1 = new JMenuItem();
  JButton employeeEditButton = new JButton();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();

  public void showSalaryButton_actionPerformed(ActionEvent e)
  {
    SelectMonthSalaryDialog smsd = new SelectMonthSalaryDialog(this,
        "员工薪水及表现列表", true);
    smsd.setBounds(120, 120, 500, 370);
    smsd.setResizable(false);
    smsd.setVisible(true);
  }

  public void jMenuItem1_actionPerformed(ActionEvent e)
  {
    this.dispose();
  }

  public void employeeEditButton_actionPerformed(ActionEvent e)
  {
    EditEmployeeDialog eed = new EditEmployeeDialog(this, "管理员工信息", true);
    eed.setBounds(120, 120, 720, 550);
    eed.setResizable(false);
    eed.setVisible(true);
  }

  public void leaveButton_actionPerformed(ActionEvent e)
  {
    Date dt = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String date = sdf.format(dt);
    System.out.println(date);
    SQLClass mySQL = new SQLClass();
    boolean flag = mySQL.askForLeave(li.getLogId(), date);
    if (flag)
    {
      JOptionPane.showMessageDialog(this, "请假成功!", "Information",
                                    JOptionPane.INFORMATION_MESSAGE);
    }
  }

  public void showBonusButton_actionPerformed(ActionEvent e)
  {
    SelectYearBonusDialog sybd = new SelectYearBonusDialog(this, "员工奖金列表", true);
    sybd.setBounds(120, 120, 500, 350);
    sybd.setResizable(false);
    sybd.setVisible(true);
  }

  public void selectByEmpIdMenuItem_itemStateChanged(ItemEvent e)
  {
    SelectEmployeeInforByEmpIdFrame byEmpIdFrame = new  SelectEmployeeInforByEmpIdFrame();
    byEmpIdFrame.setBounds(70, 120, 920, 400);
    byEmpIdFrame.setResizable(false);
    byEmpIdFrame.setVisible(true);
  }

  public void selectByEmpNameMenuItem_itemStateChanged(ItemEvent e)
  {
    SelectEmployeeInforByEmpNameFrame byEmpNameFrame = new SelectEmployeeInforByEmpNameFrame();
    byEmpNameFrame.setBounds(70, 120, 920, 400);
    byEmpNameFrame.setResizable(false);
    byEmpNameFrame.setVisible(true);
  }

  public void selectByEmpDepMenuItem_itemStateChanged(ItemEvent e)
  {
    SelectEmployeeInforByDepIdFrame byDepIdFrame = new SelectEmployeeInforByDepIdFrame();


    byDepIdFrame.setBounds(70, 120, 920, 400);
    byDepIdFrame.setResizable(false);
    byDepIdFrame.setVisible(true);
  }

  public void selectByEmpJobMenuItem_itemStateChanged(ItemEvent e)
  {
    SelectEmployeeInforByJobIdFrame byJobIdFrame = new SelectEmployeeInforByJobIdFrame();

    byJobIdFrame.setBounds(70, 120, 920, 400);
    byJobIdFrame.setResizable(false);
    byJobIdFrame.setVisible(true);
  }

  public void selectAllMenuItem_itemStateChanged(ItemEvent e)
  {
    SelectAllEmployeeInforFrame allInforFrame = new SelectAllEmployeeInforFrame();
    allInforFrame.setBounds(70, 120, 920, 400);
    allInforFrame.setResizable(false);
    allInforFrame.setVisible(true);
  }
}

class ManagerFrame_selectAllMenuItem_itemAdapter
    implements ItemListener
{
  private ManagerFrame adaptee;
  ManagerFrame_selectAllMenuItem_itemAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e)
  {
    adaptee.selectAllMenuItem_itemStateChanged(e);
  }
}

class ManagerFrame_selectByEmpDepMenuItem_itemAdapter
    implements ItemListener
{
  private ManagerFrame adaptee;
  ManagerFrame_selectByEmpDepMenuItem_itemAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e)
  {
    adaptee.selectByEmpDepMenuItem_itemStateChanged(e);
  }
}

class ManagerFrame_selectByEmpNameMenuItem_itemAdapter
    implements ItemListener
{
  private ManagerFrame adaptee;
  ManagerFrame_selectByEmpNameMenuItem_itemAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e)
  {
    adaptee.selectByEmpNameMenuItem_itemStateChanged(e);
  }
}

class ManagerFrame_selectByEmpIdMenuItem_itemAdapter
    implements ItemListener
{
  private ManagerFrame adaptee;
  ManagerFrame_selectByEmpIdMenuItem_itemAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e)
  {
    adaptee.selectByEmpIdMenuItem_itemStateChanged(e);
  }
}

class ManagerFrame_selectByEmpJobMenuItem_itemAdapter
    implements ItemListener
{
  private ManagerFrame adaptee;
  ManagerFrame_selectByEmpJobMenuItem_itemAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void itemStateChanged(ItemEvent e)
  {
    adaptee.selectByEmpJobMenuItem_itemStateChanged(e);
  }
}

class ManagerFrame_showBonusButton_actionAdapter
    implements ActionListener
{
  private ManagerFrame adaptee;
  ManagerFrame_showBonusButton_actionAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e)
  {
    adaptee.showBonusButton_actionPerformed(e);
  }
}

class ManagerFrame_leaveButton_actionAdapter
    implements ActionListener
{
  private ManagerFrame adaptee;
  ManagerFrame_leaveButton_actionAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e)
  {
    adaptee.leaveButton_actionPerformed(e);
  }
}

class ManagerFrame_employeeEditButton_actionAdapter
    implements ActionListener
{
  private ManagerFrame adaptee;
  ManagerFrame_employeeEditButton_actionAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e)
  {
    adaptee.employeeEditButton_actionPerformed(e);
  }
}

class ManagerFrame_jMenuItem1_actionAdapter
    implements ActionListener
{
  private ManagerFrame adaptee;
  ManagerFrame_jMenuItem1_actionAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e)
  {
    adaptee.jMenuItem1_actionPerformed(e);
  }
}

class ManagerFrame_showSalaryButton_actionAdapter
    implements ActionListener
{
  private ManagerFrame adaptee;
  ManagerFrame_showSalaryButton_actionAdapter(ManagerFrame adaptee)
  {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e)
  {
    adaptee.showSalaryButton_actionPerformed(e);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -