实验室设备管理系统(课程设计报告)(5)

2019-05-26 20:31

private JPasswordField pfPasswd; private JButton bConfirm, bCancel; private Container con; private JPanel[] pCon; private User info; public Login() { }

super(\用户登录\); // 控件初始化

con = getContentPane();

lPosition = new JLabel(\身 份:\); lName = new JLabel(\用户名:\); lPasswd = new JLabel(\密 码:\);

lTitle = new JLabel(\实验室设备管理系统\); lTitle.setForeground(Color.RED); pfPasswd = new JPasswordField(); bConfirm = new JButton(\确定\); bCancel = new JButton(\取消\);

String[] aPosition = new String[] { \系统管理员\, \仓库管理员\, \实验室

\购买登记员\, \上级领导\ };

管理员\,

cbPosition = new JComboBox(aPosition); int index = cbPosition.getSelectedIndex(); if (index == 0) { }

// 数组初始化

pCon = new JPanel[5];

String[] cName = info.getIdByPosition(info); cbName = new JComboBox(cName); for (int i = 0; i < pCon.length; i++)

pCon[i] = new JPanel(); info = new Administration(); info = new StoreManager(); info = new LabManager(); info = new BuyManager(); info = new OverLeader(); } else if (index == 1) { } else if (index == 2) { } else if (index == 3) { } else {

// 定义按钮,下拉框处理器

class ListenAction implements ActionListener {

public void actionPerformed(ActionEvent e) {

if (e.getSource() == bConfirm) {//点击确定按钮

info.setuId(cbName.getSelectedItem().toString()); info.setuPasswd(new String(pfPasswd.getPassword())); info.setuPosition(cbPosition.getSelectedItem().toString()); if (info.login(info)) {

new Main(info).launch(); setVisible(false); pfPasswd.setText(null);

JOptionPane.showMessageDialog(new Login(), \用户名,密码或

}

// 添加监听器

cbPosition.addActionListener(new ListenAction()); bConfirm.addActionListener(new ListenAction()); bCancel.addActionListener(new ListenAction()); pfPasswd.addKeyListener(new ListenKey());

// 控件设置

pfPasswd.setEchoChar('*'); pfPasswd.setColumns(10); setBounds(400, 100, 400, 400); setVisible(true);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); public void launch() {

// 控件添加

con.setLayout(new GridLayout(5, 1)); pCon[0].add(lPosition); pCon[0].add(cbPosition); pCon[1].add(lName); pCon[1].add(cbName); pCon[2].add(lPasswd); pCon[2].add(pfPasswd); pCon[3].add(bConfirm); pCon[3].add(bCancel); pCon[4].add(lTitle); add(pCon[4]);

for (int i = 0; i < pCon.length - 1; i++)

con.add(pCon[i]);

} else {

身份错误\); } }

}

}

//定义键盘处理器

class ListenKey extends KeyAdapter {

@SuppressWarnings(\) public void keyPressed(KeyEvent e) {

if (e.getKeyText(e.getKeyCode()).compareToIgnoreCase(\) == }

bConfirm.doClick();

}

}

}

pfPasswd.setText(null);

}

int index = cbPosition.getSelectedIndex(); if (index == 0) { }

String[] cName = info.getIdByPosition(info);

//刷新用户名列表

cbName.removeAllItems();

for (int i = 0; i < cName.length; i++)

cbName.addItem(cName[i]); info = new Administration(); info = new StoreManager(); info = new LabManager(); info = new BuyManager(); info = new OverLeader(); } else if (index == 1) { } else if (index == 2) { } else if (index == 3) { } else {

pfPasswd.setText(null);

} else if (e.getSource() == cbPosition) {//身份下拉框改变时

} else {

System.exit(0);

0) {

2、主界面:

package com.niit.gui_event;

import javax.swing.*; import com.niit.logical.*; import java.awt.event.*;

public class Main extends JFrame {

public Main() { }

super(\实验室设备管理系统\); tp = new JTabbedPane(); p = new JPanel[8]; /** * */

private static final long serialVersionUID = 1L; private JTabbedPane tp; private JPanel p[];

private User info;

public Main(User info){ }

public void launch() {

tp.addTab(\用户管理\, p[0]); tp.addTab(\设备入库\, p[1]); tp.addTab(\设备出库\, p[2]); tp.addTab(\设备登记\, p[3]); tp.addTab(\设备申请\, p[4]); tp.addTab(\审核申请\, p[5]); tp.addTab(\统计查询\, p[6]); tp.addTab(\个人信息维护\, p[7]);

if(info instanceof Administration){

tp.setEnabledAt(1, false); tp.setEnabledAt(2, false); tp.setEnabledAt(3, false); tp.setEnabledAt(4, false); tp.setEnabledAt(5, false); tp.setEnabledAt(6, false); tp.setEnabledAt(0, false); tp.setEnabledAt(3, false); tp.setEnabledAt(5, false); tp.setSelectedIndex(1); tp.setEnabledAt(0, false); tp.setEnabledAt(1, false); tp.setEnabledAt(2, false); tp.setEnabledAt(5, false); tp.setSelectedIndex(3); this();

this.info=info;

p[0] = new UserManage(); p[1] = new EquipIn(); p[2] = new EquipOut(); p[3] = new Register(info); p[4] = new Apply(info); p[5] = new Checks(info); p[6]= new Search();

p[7]=new PasswdModyfy(info);

}else if(info instanceof StoreManager){

}else if(info instanceof LabManager){

}else if(info instanceof BuyManager){


实验室设备管理系统(课程设计报告)(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:比选采购文件

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

马上注册会员

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