package com.mwq.frame;
// Download by http://www.codefans.net
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.TitledBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import com.mwq.PersonnelManage;
import com.mwq.frame.personnel.BringUpSelectedPanel;
import com.mwq.frame.personnel.RecordSelectedPanel;
import com.mwq.frame.personnel.RewardsAndPunishmentPanel;
import com.mwq.frame.personnel.TimecardPanel;
import com.mwq.frame.system.DataPanel;
import com.mwq.frame.system.FrameworkPanel;
import com.mwq.frame.treatement.CriterionSetPanel;
import com.mwq.frame.treatement.PersonnelSetPanel;
import com.mwq.frame.treatement.ReportFormsPanel;
import com.mwq.frame.user.AddUserPanel;
import com.mwq.frame.user.UpdatePasswordDialog;
import com.mwq.hibernate.Dao;
import com.mwq.hibernate.mapping.TbRecord;
public class IndexFrame extends JFrame {
private JTree tree;
final JPanel rightPanel = new JPanel();
private TbRecord record;
private final Dao dao = Dao.getInstance();
/**
* Launch the application
*
* @param args
*/
public static void main(String args[]) {
try {
IndexFrame frame = new IndexFrame(null);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the frame
*/
public IndexFrame(TbRecord tbRecord) {
super();
this.record = tbRecord;
setResizable(false);
setExtendedState(IndexFrame.MAXIMIZED_BOTH);// 设置窗口以最大化打开
setTitle(" T 科技");
setBounds(0, 0, 950, 700);
setBounds(0, 0, 1024, 768);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
topPanel.setPreferredSize(new Dimension(0, 100));
getContentPane().add(topPanel, BorderLayout.NORTH);
final JLabel label = new JLabel();
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setHorizontalTextPosition(SwingConstants.CENTER);
URL resource = IndexFrame.this.getClass().getResource("/img/logo.JPG");
ImageIcon icon = new ImageIcon(resource);
label.setIcon(icon);
label.setBorder(new TitledBorder(null, "",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, null));
label.setPreferredSize(new Dimension(160, 0));
topPanel.add(label, BorderLayout.WEST);
final JPanel buttonPanel = new JPanel();// 创建工具栏面板
final GridLayout gridLayout = new GridLayout(1, 0);// 创建一个水平箱式布局管理器对象
gridLayout.setVgap(6);// 箱的垂直间隔为6像素
gridLayout.setHgap(6);// 箱的水平间隔为6像素
buttonPanel.setLayout(gridLayout);// 设置工具栏面板采用的布局管理器为箱式布局
buttonPanel.setBackground(new Color(90, 130, 189));// 设置工具栏面板的背景色
buttonPanel.setBorder(new TitledBorder(null, "",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, null));// 设置工具栏面板采用的边框样式
topPanel.add(buttonPanel, BorderLayout.CENTER);// 将工具栏面板添加到上级面板中
final JButton recordShortcutKeyButton = new JButton();// 创建进入“档案管理”的快捷按钮
resource = this.getClass().getResource("/img/record.JPG");
icon = new ImageIcon(resource);
recordShortcutKeyButton.setIcon(icon);
// 为按钮添加事件监听器,用来捕获按钮被点击的事件
recordShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();// 移除内容面板中的所有内容
rightPanel.add(new RecordSelectedPanel(rightPanel),
BorderLayout.CENTER);// 将档案管理面版添加到内容面板中
SwingUtilities.updateComponentTreeUI(rightPanel);// 刷新内容面板中的内容
}
});
buttonPanel.add(recordShortcutKeyButton);
final JButton timecardShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/timecard.JPG");
icon = new ImageIcon(resource);
timecardShortcutKeyButton.setIcon(icon);
timecardShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();
rightPanel.add(new TimecardPanel(), BorderLayout.CENTER);
SwingUtilities.updateComponentTreeUI(rightPanel);
}
});
buttonPanel.add(timecardShortcutKeyButton);
final JButton rewardsAndPunishmentShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/rewAndPun.JPG");
icon = new ImageIcon(resource);
rewardsAndPunishmentShortcutKeyButton.setIcon(icon);
rewardsAndPunishmentShortcutKeyButton
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();
rightPanel.add(new RewardsAndPunishmentPanel(),
BorderLayout.CENTER);
SwingUtilities.updateComponentTreeUI(rightPanel);
}
});
buttonPanel.add(rewardsAndPunishmentShortcutKeyButton);
final JButton reportFormsShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/stat.JPG");
icon = new ImageIcon(resource);
reportFormsShortcutKeyButton.setIcon(icon);
reportFormsShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();
rightPanel.add(new ReportFormsPanel(), BorderLayout.CENTER);
SwingUtilities.updateComponentTreeUI(rightPanel);
}
});
buttonPanel.add(reportFormsShortcutKeyButton);
final JButton basicDataShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/data.JPG");
icon = new ImageIcon(resource);
basicDataShortcutKeyButton.setIcon(icon);
basicDataShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();
rightPanel.add(new DataPanel(), BorderLayout.CENTER);
SwingUtilities.updateComponentTreeUI(rightPanel);
}
});
buttonPanel.add(basicDataShortcutKeyButton);
final JButton updatePasswordShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/password.JPG");
icon = new ImageIcon(resource);
updatePasswordShortcutKeyButton.setIcon(icon);
if (record == null)// 当record为null时,说明是通过默认用户登录的,此时不能修改密码
updatePasswordShortcutKeyButton.setEnabled(false);// 在这种情况下设置按钮不可用
updatePasswordShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rightPanel.removeAll();
SwingUtilities.updateComponentTreeUI(rightPanel);
UpdatePasswordDialog dialog = new UpdatePasswordDialog();// 创建用来修改密码的对话框
dialog.setRecord(record);// 将当前登录管理员的档案对象传入对话框
dialog.setVisible(true);// 设置对话框为可见的,即显示对话框
}
});
buttonPanel.add(updatePasswordShortcutKeyButton);
final JButton counterShortcutKeyButton = new JButton();
resource = this.getClass().getResource("/img/calculator.JPG");
icon = new ImageIcon(resource);
counterShortcutKeyButton.setIcon(icon);
counterShortcutKeyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Desktop desktop = Desktop.getDesktop();// 获得当前系统对象
File file = new File("C:/W
renshiguanli.rar_4 3 2 1
版权申诉
72 浏览量
2022-09-24
19:09:39
上传
评论
收藏 7KB RAR 举报
钱亚锋
- 粉丝: 88
- 资源: 1万+
最新资源
- JSP Explorer 文件浏览器 v1.0-fileexplorer.zip
- JS+Flash让网页元素发光的插件 glow! 0.1-glow.zip
- JdonFramework开源框架 v5.1 Build20071025-jdonframework-5.1.zip
- 汽车行驶工况数据,excel,m文件
- Xshell6是一款功能强大的终端模拟器软件,主要用于远程管理和访问多种网络设备和服务器
- OPA548运放E/S脚使能后,输入电压为零时,输出电压为0.6V;电路如何设计才能使输出电压偏置为:0V
- MicrosoftRootCertificateAuthority2011.rar
- ISOSAE21434.D1-2020SAE美国汽车标准
- 奥比中光RGBD在JETSON ORIN NX的ROS程序
- SerialNumberUtil.java
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈