




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
package com.mwq.frame.user;import java.awt.Dimension;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import com.mwq.hibernate.Dao;import com.mwq.hibernate.HibernateSessionFactory;import com.mwq.hibernate.mapping.TbManager;import com.mwq.hibernate.mapping.TbRecord;public class UpdatePasswordDialog extends JDialog private JPasswordField oldPasswordField;private JPasswordField repeatPasswordField;private JPasswordField newPasswordField;private TbRecord record;private final Dao dao = Dao.getInstance();/* * Launch the application * * param args */public static void main(String args) try UpdatePasswordDialog dialog = new UpdatePasswordDialog();dialog.addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0););dialog.setVisible(true); catch (Exception e) e.printStackTrace();/* * Create the dialog */public UpdatePasswordDialog() super();getContentPane().setLayout(new GridBagLayout();setModal(true);setTitle(修改密码);Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();setBounds(screenSize.width - 300) / 2, (screenSize.height - 200) / 2,300, 200);final JLabel oldPasswordLabel = new JLabel();oldPasswordLabel.setText(原 密 码:);final GridBagConstraints gridBagConstraints_7 = new GridBagConstraints();gridBagConstraints_7.gridx = 0;gridBagConstraints_7.gridy = 0;getContentPane().add(oldPasswordLabel, gridBagConstraints_7);oldPasswordField = new JPasswordField();oldPasswordField.setColumns(25);final GridBagConstraints gridBagConstraints_8 = new GridBagConstraints();gridBagConstraints_8.gridwidth = 3;gridBagConstraints_8.gridy = 0;gridBagConstraints_8.gridx = 1;getContentPane().add(oldPasswordField, gridBagConstraints_8);final JLabel newPasswordLabel = new JLabel();newPasswordLabel.setText(新 密 码:);final GridBagConstraints gridBagConstraints = new GridBagConstraints();gridBagConstraints.insets = new Insets(10, 0, 0, 0);gridBagConstraints.gridy = 1;gridBagConstraints.gridx = 0;getContentPane().add(newPasswordLabel, gridBagConstraints);newPasswordField = new JPasswordField();newPasswordField.setColumns(25);final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();gridBagConstraints_1.insets = new Insets(10, 0, 0, 0);gridBagConstraints_1.gridwidth = 3;gridBagConstraints_1.gridy = 1;gridBagConstraints_1.gridx = 1;getContentPane().add(newPasswordField, gridBagConstraints_1);final JLabel repeatPasswordLabel = new JLabel();repeatPasswordLabel.setText(重新输入:);final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();gridBagConstraints_2.insets = new Insets(10, 0, 0, 0);gridBagConstraints_2.gridy = 2;gridBagConstraints_2.gridx = 0;getContentPane().add(repeatPasswordLabel, gridBagConstraints_2);repeatPasswordField = new JPasswordField();repeatPasswordField.setColumns(25);final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();gridBagConstraints_3.gridwidth = 3;gridBagConstraints_3.insets = new Insets(10, 0, 0, 0);gridBagConstraints_3.gridy = 2;gridBagConstraints_3.gridx = 1;getContentPane().add(repeatPasswordField, gridBagConstraints_3);final JLabel label = new JLabel();label.setPreferredSize(new Dimension(30, 20);final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();gridBagConstraints_6.gridy = 3;gridBagConstraints_6.gridx = 1;getContentPane().add(label, gridBagConstraints_6);final JButton submitButton = new JButton();submitButton.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) char oldPasswords = oldPasswordField.getPassword();StringBuffer oldPassword = new StringBuffer();for (int i = 0; i oldPasswords.length; i+) oldPassword.append(oldPasswordsi);char newPasswords = newPasswordField.getPassword();StringBuffer newPassword = new StringBuffer();for (int i = 0; i newPasswords.length; i+) newPassword.append(newPasswordsi);char repeatPasswords = repeatPasswordField.getPassword();StringBuffer repeatPassword = new StringBuffer();for (int i = 0; i repeatPasswords.length; i+) repeatPassword.append(repeatPasswordsi);TbManager manager = record.getTbManager();if (!oldPassword.toString().equals(manager.getPassword() JOptionPane.showMessageDialog(null, 您输入的原密码错误,请确认后重新输入!,友情提示, JOptionPane.INFORMATION_MESSAGE);return;if (!newPassword.toString().equals(repeatPassword.toString() JOptionPane.showMessageDialog(null,您两次输入的新密码不一致,请确认后重新输入!, 友情提示,JOptionPane.INFORMATION_MESSAGE);return;manager.setPassword(newPassword.toString();dao.updateObject(manager);HibernateSessionFactory.closeSession();JOptionPane.showMessageDialog(null, 密码修改成功!, 友情提示,JOptionPane.INFORMATION_MESSAGE);dispose(););submitButton.setText(确定);final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();gridBagConstraints_4.insets = new Insets(10, 0, 0, 0);gridBagConstraints_4.gridy = 3;gridBagConstraints_4.gridx = 2;getContentPane().add(submitButton, gridBagConstraints_4);final JButton exitButton = new JButton();exitButton.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) dispose(););exitButton.setText(退出);final GridBagConstraint
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 咨询服务方案的工作计划
- 鄂州的栈桥施工方案
- 团队活动方案策划奖品
- 息烽公司培训活动策划方案
- 咨询客服优化方案
- 药品执法培训课件
- 建筑山石开挖方案设计
- 班级搞野餐活动方案策划
- 建筑竞标方案设计费
- 税务咨询客户服务方案
- (2025秋新版)苏教版三年级数学上册全册教案
- 2025年秋期人教版五年级上册数学全册核心素养教案(教学反思有内容+二次备课版)
- 《清华大学介绍》课件
- 铁路防雷及接地工程技术规范(TB 10180-2016)
- 无人机操作与使用教案
- 自悯量表中文版
- DB32∕T 2975-2016 水运工程建设管理用表
- T∕FSI 084-2022 双酚AF
- K线八低八高技术系统讲解课程(三)
- 铁路技规第十六章资料
- 全国专利代理行业服务收费指导价格(试行)
评论
0/150
提交评论