⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateusefrm.java

📁 一个简单的机房管理系统 可以简单的实现查询,计费 上下机,充值等功能
💻 JAVA
字号:
package src.netbar;

import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import src.Rule.adminCardRule;
import src.Rule.UpComputerRule;
import src.Bean.UpComputerCardBean;
import java.sql.*;

/**
 *修改会员帐号
 */
public class upDateUseFrm
    extends JFrame {
  adminCardRule adminRule;
  UpComputerRule upCardRule;
  UpComputerCardBean CardBean = new UpComputerCardBean();
  public upDateUseFrm() {
    try {
      jbInit();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    getContentPane().setLayout(null);
    this.setBounds(440, 250, 570, 390);
    setSize(new Dimension(400, 300));
    this.setTitle("机房管理系统 -- 修败上机卡帐号");
    this.setResizable(false);
    jLabel1.setFont(new java.awt.Font("黑体", Font.PLAIN, 25));
    jLabel1.setForeground(Color.blue);
    jLabel1.setText("修改用户帐号");
    jLabel1.setBounds(new Rectangle(103, 29, 151, 39));
    jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    jLabel2.setText("用户帐号");
    jLabel2.setBounds(new Rectangle(85, 72, 61, 28));
    jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    jLabel3.setText("用户密码");
    jLabel3.setBounds(new Rectangle(85, 108, 56, 22));
    jLabel4.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    jLabel4.setText("新密码");
    jLabel4.setBounds(new Rectangle(91, 141, 50, 19));
    jLabel5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    jLabel5.setText("确认密码");
    jLabel5.setBounds(new Rectangle(85, 169, 57, 20));
    txtUpDateName.setText("");
    txtUpDateName.setBounds(new Rectangle(165, 74, 114, 21));
    pwfUpDateOldPass.setText("");
    pwfUpDateOldPass.setBounds(new Rectangle(165, 108, 114, 20));
    pwfUpDateNewPass.setText("");
    pwfUpDateNewPass.setBounds(new Rectangle(164, 137, 115, 22));
    pwfUpDateChickNewPass.setText("");
    pwfUpDateChickNewPass.setBounds(new Rectangle(164, 170, 115, 21));
    butUpdateOK.setBounds(new Rectangle(98, 213, 75, 23));
    butUpdateOK.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    butUpdateOK.setText("确定");
    butUpdateOK.addActionListener(new upDateUseFrm_butUpdateOK_actionAdapter(this));
    butUpdateClare.setBounds(new Rectangle(208, 212, 72, 23));
    butUpdateClare.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
    butUpdateClare.setToolTipText("");
    butUpdateClare.setText("重填");
    butUpdateClare.addActionListener(new
                                     upDateUseFrm_butUpdateClare_actionAdapter(this));
    this.getContentPane().add(jLabel1);
    this.getContentPane().add(jLabel2);
    this.getContentPane().add(txtUpDateName);
    this.getContentPane().add(jLabel3);
    this.getContentPane().add(jLabel4);
    this.getContentPane().add(jLabel5);
    this.getContentPane().add(pwfUpDateOldPass);
    this.getContentPane().add(pwfUpDateNewPass);
    this.getContentPane().add(pwfUpDateChickNewPass);
    this.getContentPane().add(butUpdateOK);
    this.getContentPane().add(butUpdateClare);
    adminRule = new adminCardRule();
    upCardRule = new UpComputerRule();
  }

  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  JLabel jLabel5 = new JLabel();
  JTextField txtUpDateName = new JTextField();
  JPasswordField pwfUpDateOldPass = new JPasswordField();
  JPasswordField pwfUpDateNewPass = new JPasswordField();
  JPasswordField pwfUpDateChickNewPass = new JPasswordField();
  JButton butUpdateOK = new JButton();
  JButton butUpdateClare = new JButton();
  public void butUpdateClare_actionPerformed(ActionEvent e) {
    this.txtUpDateName.setText("");
    this.pwfUpDateOldPass.setText("");
    this.pwfUpDateNewPass.setText("");
    this.pwfUpDateChickNewPass.setText("");
  }

  public void butUpdateOK_actionPerformed(ActionEvent e) {
    String name = this.txtUpDateName.getText();
    String oldPass = String.valueOf(this.pwfUpDateOldPass.getPassword());
    String newPass = String.valueOf(this.pwfUpDateNewPass.getPassword());
    String chicknewPass = String.valueOf(this.pwfUpDateChickNewPass.getPassword());
    CardBean.setUserName(name);
    try {
      CardBean.setPassword(oldPass);
      if (upCardRule.upComputer_CardCheck(CardBean)) {
        if (newPass.equals(chicknewPass)) {
          CardBean.setPassword(newPass);
          adminRule.setNewPass(CardBean);
          JOptionPane.showMessageDialog(this, "密码修改成功!!\n请使用新密码登陆!!", "提示",
                                        JOptionPane.PLAIN_MESSAGE,
                                        new ImageIcon("imags\\kawayi.gif"));
          this.txtUpDateName.setText("");
          this.pwfUpDateOldPass.setText("");
          this.pwfUpDateNewPass.setText("");
          this.pwfUpDateChickNewPass.setText("");

        }
        else {
          JOptionPane.showMessageDialog(this, "两次密码不相同!!", "提示",
                                        JOptionPane.PLAIN_MESSAGE,
                                        new ImageIcon("imags\\gaida.gif"));
          this.pwfUpDateNewPass.setText("");
          this.pwfUpDateChickNewPass.setText("");
        }
      }
      else {
        JOptionPane.showMessageDialog(this, "用户名或密码不正确!!", "提示",
                                      JOptionPane.PLAIN_MESSAGE,
                                      new ImageIcon("imags\\gaida.gif"));
        this.txtUpDateName.setText("");
        this.pwfUpDateOldPass.setText("");
        this.pwfUpDateNewPass.setText("");
        this.pwfUpDateChickNewPass.setText("");
      }
    }
    catch (HeadlessException ex) {
    }
    catch (SQLException ex) {
    }
  }
}

class upDateUseFrm_butUpdateOK_actionAdapter
    implements ActionListener {
  private upDateUseFrm adaptee;
  upDateUseFrm_butUpdateOK_actionAdapter(upDateUseFrm adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.butUpdateOK_actionPerformed(e);
  }
}

class upDateUseFrm_butUpdateClare_actionAdapter
    implements ActionListener {
  private upDateUseFrm adaptee;
  upDateUseFrm_butUpdateClare_actionAdapter(upDateUseFrm adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.butUpdateClare_actionPerformed(e);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -