大学生社团信息管理系统(5)

2020-02-21 20:57

}

this.setIconifiable(true); this.setClosable(true); this.setTitle(\添加新用户\

this.setContentPane(getJContentPane()); this.setVisible(true);

private JPanel getJContentPane() {

if (jContentPane == null) {

password = new JLabel(\密码:\password.setFont(new Font(\宋体\password.setBounds(new Rectangle(45, 130, 93, 34)); passwordTwo=new JLabel(\再次确认:\passwordTwo.setFont(new Font(\宋体\passwordTwo.setBounds(new Rectangle(36, 177, 150, 34)); name = new JLabel(\姓名:\name.setFont(new Font(\宋体\name.setBounds(new Rectangle(44, 83, 90, 29)); lbTip = new JLabel(\添加新用户\lbTip.setBounds(new Rectangle(0, 0, 500, 80)); lbTip.setForeground(Color.blue);

lbTip.setFont(new Font(\黑体\jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(lbTip, null); jContentPane.add(name, null); jContentPane.add(passwordTwo, null);

jContentPane.add(getTxtBookTypeName(), null); jContentPane.add(password, null);

jContentPane.add(getTxtBookTypeDesc(), null); jContentPane.add(getPasswordTwo(), null);

17

}

}

jContentPane.add(getBtnAdd(), null); jContentPane.add(getBtnCancel(), null);

return jContentPane;

private JTextField getPasswordTwo() { }

private JTextField getTxtBookTypeName() { }

private JTextField getTxtBookTypeDesc() { }

private JButton getBtnAdd() {

if (btnAdd == null) {

btnAdd = new JButton(\添加\

18

if (inputPasswordTwo == null) { }

return inputPasswordTwo;

inputPasswordTwo = new JPasswordField();

inputPasswordTwo.setBounds(new Rectangle(170, 177, 170, 25));

if (inputName == null) { }

return inputName;

inputName = new JTextField();

inputName.setBounds(new Rectangle(170, 83, 170, 25));

if (inputPassword == null) { }

return inputPassword;

inputPassword = new JPasswordField();

inputPassword.setBounds(new Rectangle(170, 130, 170, 25));

\

btnAdd.setFont(new Font(\宋体\btnAdd.setBounds(new Rectangle(120, 240,70, 30)); btnAdd.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { String Name=inputName.getText().trim(); String Password=inputPassword.getText().trim(); String PasswordTwo=inputPasswordTwo.getText().trim(); if(StringUtil.isEmpty(Name)) { JOptionPane.showMessageDialog(null,\姓名不能为空!\ inputName.requestFocus(); return;

}

if(StringUtil.isEmpty(Password)) { JOptionPane.showMessageDialog(null,\密码不能为空!\ inputPassword.requestFocus(); return;

}

if(StringUtil.isEmpty(PasswordTwo)) {

JOptionPane.showMessageDialog(null,\请再次输入密码! inputPasswordTwo.requestFocus(); return;

}

if(Password.equals(PasswordTwo)) {

BookType bookType=new BookType(Name,Password);

int flag=new BookTypeDao().addBookType(bookType);

19

if(flag>0) {

JOptionPane.showMessageDialog(null, \添加成功!\inputName.setText(\inputPassword.setText(\inputPasswordTwo.setText(\inputName.requestFocus();

}else{ } } else{

JOptionPane.showMessageDialog(null, \两次密码输入不JOptionPane.showMessageDialog(null, \添加失败!\

一致,请重新输入!\

}

}

});

}

}

inputPassword.setText(\inputPasswordTwo.setText(\inputPassword.requestFocus(); return;

return btnAdd;

private JButton getBtnCancel() {

if (btnCancel == null) {

20

}

}

}

btnCancel = new JButton();

btnCancel.setBounds(new Rectangle(250, 240, 70, 30)); btnCancel.setText(\取消\

btnCancel.setFont(new Font(\宋体\

return btnCancel;

(2)修改密码

当单击修改密码,则系统会运行相应的代码,出现修改密码窗口,原密码就是登录系统的密码,新密码是重新定义的密码,修改密码之后,旧密码不能登录系统,应该用新密码登录该系统,在修改密码过程中,两次新密码必须一致,否则不能修改密码。系统运行结果如图5.3所示,相应的代码如下。

图5.3 修改密码窗体运行结果

修改密码相应代码:

package com.zky.www.view;

21


大学生社团信息管理系统(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:小学数学

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

马上注册会员

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