人事管理系统 - 图文(10)

2019-08-03 13:46

JPanel upPanel = new JPanel(); JPanel centerPanel = new JPanel(); JPanel downPanel = new JPanel();

//定义图形界面元素 JLabel jLabel = new JLabel(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel();

JTextField jTextField1 = new JTextField(15); JTextField jTextField2 = new JTextField(15); String DeptID = \String PersonID = null; String oldDeptID = null; JComboBox jComboBox1 = null; JButton modifyInfo = new JButton(); JButton clearInfo = new JButton(); //定义表格

JScrollPane jScrollPane1; JTable jTable;

ListSelectionModel listSelectionModel = null;

String[] colName = {\工号\姓名\性别\部门\薪酬\考核信息\

public Node21Panel() {

this.setLayout(new BorderLayout()); try {

upInit(); //上部面板布局 centerInit(); //中部面板布局 downInit(); //下部面板布局 addListener();

GridBagLayout girdBag = new GridBagLayout(); GridBagConstraints girdBagCon; String[][] colValue;

} /**

}

catch(Exception }

e) {

e.printStackTrace();

* 上部面板的布局 */

public void upInit() throws Exception {

PersonBean bean = new PersonBean(); upPanel.setLayout(girdBag); try {

jLabel.setText(\人员调动\

jLabel.setFont(new Font(\girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 0; girdBagCon.gridy = 0;

girdBagCon.insets = new Insets(0,10,0,10); girdBag.setConstraints(jLabel,girdBagCon); upPanel.add(jLabel);

colValue = bean.searchAllForNode(); jTable = new JTable(colValue,colName);

jTable.setPreferredScrollableViewportSize(new Dimension(450,300)); listSelectionModel = jTable.getSelectionModel();

listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSelectionModel.addListSelectionListener(this); jScrollPane1 = new JScrollPane(jTable);

jScrollPane1.setPreferredSize(new Dimension(450,300)); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 0; girdBagCon.gridy = 1;

girdBagCon.insets = new Insets(0,0,0,0); girdBag.setConstraints(jScrollPane1,girdBagCon); upPanel.add(jScrollPane1);

} /**

}

catch(Exception e) { }

//添加上部面板

this.add(upPanel,BorderLayout.NORTH);

e.printStackTrace();

* 中部面板的布局 */

public void centerInit() throws Exception { }

jLabel1.setText(\姓名\

jLabel1.setFont(new Font(\centerPanel.add(jLabel1); centerPanel.add(jTextField1); jLabel2.setText(\原部门\

jLabel2.setFont(new Font(\centerPanel.add(jLabel2); centerPanel.add(jTextField2); jLabel3.setText(\新部门\

jLabel3.setFont(new Font(\centerPanel.add(jLabel3); DeptBean tbean = new DeptBean(); String[] allType = tbean.searchAllForNode(); jComboBox1 = new JComboBox(allType); centerPanel.add(jComboBox1); //添加中部面板

this.add(centerPanel,BorderLayout.CENTER); //设置是否可操作

jTextField1.setEditable(false); jTextField2.setEditable(false); jComboBox1.setEnabled(false);

/**

* 下部面板的布局 */

public void downInit() throws Exception { } /**

* 添加事件侦听 */

public void addListener() throws Exception { } /**

* 事件处理 */

public void actionPerformed(ActionEvent e) {

Object obj = e.getSource(); if (obj == modifyInfo) { //修改

PersonBean bean = new PersonBean(); oldDeptID = bean.getDeptId(PersonID);

if(oldDeptID == DeptID||oldDeptID.equals(DeptID)){ //添加事件侦听

modifyInfo.addActionListener(this); clearInfo.addActionListener(this); jComboBox1.addItemListener(this); modifyInfo.setText(\调入新部门\

modifyInfo.setFont(new Font(\downPanel.add(modifyInfo); clearInfo.setText(\清空信息\

clearInfo.setFont(new Font(\downPanel.add(clearInfo); //添加下部面板

this.add(downPanel,BorderLayout.SOUTH); //设置是否可操作

modifyInfo.setEnabled(false); clearInfo.setEnabled(true);

} /**

}

}

JOptionPane.showMessageDialog(null, \请选择不同的部门\错误\oldDeptID = null; return;

bean.updateDept(PersonID,DeptID); HistrjnBean hbean = new HistrjnBean(); String f1 = \

String f5 = \人员调动\java.util.Date now = new java.util.Date();

DateFormat date = DateFormat.getDateTimeInstance(); String f6 = \

hbean.add(f1,\人员调动\//重新生成界面

Node21Panel dp = new Node21Panel(); HrMain.splitPane.setRightComponent(dp);

JOptionPane.ERROR_MESSAGE);

}else{

else if (obj == clearInfo) { //清空 }

jTable.revalidate();

setNull();

* 将文本框清空 */

void setNull(){ } /**

jTextField1.setText(null); jTextField2.setText(null); jTextField1.setEditable(false); jTextField2.setEditable(false); modifyInfo.setEnabled(false); clearInfo.setEnabled(true); jComboBox1.setEnabled(false);


人事管理系统 - 图文(10).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:人教版小学六年级英语上册教案绝版好课件 - 路过别错过

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: