Ejemplo n.º 1
0
  /** 人员管理 */
  private void DMManage() {
    print.setEnabled(true);
    printAction.setEnabled(true);

    // 删除原有内容
    if (displayPanel != null && tips != null) {
      contentPanel.remove(displayPanel);
      contentPanel.remove(tips);
      validate();
      repaint();
    }

    staffContent = GetInfo.getStaffInfo();
    staffTitle = GetInfo.getStaffTitle();

    content = VectorFilter.doubleFilter(VectorFilter.STAFFFILTER, staffContent);
    content = VectorFilter.dataFilter(1, staffInfo.getStaffName(), content); // 过滤自己
    content = VectorFilter.positionFilter(4, "部门经理", content); // 过滤得到部门经理
    header = VectorFilter.singleFilter(VectorFilter.STAFFFILTER, staffTitle);

    // 建立显示区面板
    displayPanel = new JPanel(new BorderLayout());
    displayPanel.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "人员管理"));

    // 加入JTable
    setTable(content, header);
    scrollPanel = new JScrollPane(table);
    displayPanel.add(scrollPanel, BorderLayout.CENTER);

    // 加入功能区
    Box functionBox = Box.createVerticalBox();
    Box functionTop = Box.createVerticalBox();
    Box functionCenter = Box.createHorizontalBox();
    Box functionUnderCenterTop = Box.createVerticalBox();
    Box functionUnderCenter = Box.createHorizontalBox();
    Box functionBottom = Box.createVerticalBox();

    functionTop.add(Box.createVerticalStrut(10));
    functionUnderCenterTop.add(Box.createVerticalStrut(10));
    functionBottom.add(Box.createVerticalStrut(20));

    JLabel sift = new JLabel("筛选");
    sift.setFont(font);
    siftKey.setText("");
    JLabel fun = new JLabel("功能");
    fun.setFont(font);
    viewDM.setText("查看");
    viewDM.setFont(font);
    addDM.setText("增加");
    addDM.setFont(font);
    deleteDM.setText("删除");
    deleteDM.setFont(font);
    modifyDM.setText("修改");
    modifyDM.setFont(font);
    modifyDMPassword.setText("设置密码");
    modifyDMPassword.setFont(font);
    hideOutDate.setFont(font);
    functionCenter.add(Box.createHorizontalStrut(2));
    functionCenter.add(sift);
    functionCenter.add(Box.createHorizontalStrut(10));
    functionCenter.add(siftKey);
    functionCenter.add(Box.createHorizontalStrut(100));
    functionCenter.add(hideOutDate);
    functionCenter.add(Box.createHorizontalStrut(180));
    functionUnderCenter.add(Box.createHorizontalStrut(2));
    functionUnderCenter.add(fun);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(viewDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(addDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(deleteDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(modifyDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(modifyDMPassword);
    functionUnderCenter.add(Box.createHorizontalGlue());

    functionBox.add(functionTop);
    functionBox.add(functionCenter);
    functionBox.add(functionUnderCenterTop);
    functionBox.add(functionUnderCenter);
    functionBox.add(functionBottom);
    displayPanel.add(functionBox, BorderLayout.SOUTH);

    // 建立提示区面板
    tips = Box.createHorizontalBox();
    tips.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "系统提示"));
    tips.add(Box.createHorizontalStrut(200));

    // 加入系统提示
    // TODO 加入系统提示信息

    contentPanel.add(displayPanel, BorderLayout.CENTER);
    contentPanel.add(tips, BorderLayout.EAST);

    validate();
  }
Ejemplo n.º 2
0
  /** 生成面板内容 */
  private void createContent() {
    contentPanel = new JPanel(new BorderLayout());
    panel.add(contentPanel, BorderLayout.CENTER);

    Box message = Box.createVerticalBox();
    message.setBorder(BorderFactory.createEtchedBorder());

    dateImg = new JLabel(new ImageIcon(TMFrame.class.getResource("/images/calendar.gif")));
    String today = Today.getYear() + "年" + Today.getMonth() + "月" + Today.getDate() + "日";
    date = new JLabel(today);
    date.setFont(font);
    week = new JLabel(Today.getWeek());
    week.setFont(font);
    nameImg = new JLabel(new ImageIcon(TMFrame.class.getResource("/images/role.png")));
    name = new JLabel(staffInfo.getStaffName());
    name.setFont(font);
    role = new JLabel("总经理");
    role.setFont(font);

    Box messageTop = Box.createVerticalBox();
    Box messageCenter = Box.createHorizontalBox();
    Box messageBottom = Box.createVerticalBox();

    messageTop.add(Box.createVerticalStrut(1));
    messageCenter.add(Box.createHorizontalStrut(5));
    messageCenter.add(dateImg);
    messageCenter.add(Box.createHorizontalStrut(2));
    messageCenter.add(date);
    messageCenter.add(Box.createHorizontalStrut(20));
    messageCenter.add(week);
    messageCenter.add(Box.createHorizontalStrut(50));
    messageCenter.add(nameImg);
    messageCenter.add(Box.createHorizontalStrut(2));
    messageCenter.add(name);
    messageCenter.add(Box.createHorizontalStrut(20));
    messageCenter.add(role);
    messageCenter.add(Box.createHorizontalGlue());
    messageBottom.add(Box.createVerticalStrut(1));

    message.add(messageTop);
    message.add(messageCenter);
    message.add(messageBottom);
    contentPanel.add(message, BorderLayout.NORTH);
  }