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

📄 frameupdate.java

📁 数字证书注册和签发系统
💻 JAVA
字号:
package cproissue;

import java.awt.BorderLayout;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.security.*;
import java.security.cert.Certificate;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import java.awt.Color;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class FrameUpdate extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    CertEntity ce;
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JPasswordField oldstorepass = new JPasswordField();
  JPasswordField newstorepass = new JPasswordField();
  JPasswordField newstorepassok = new JPasswordField();
  JLabel jinggao = new JLabel();
    public FrameUpdate() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
    public FrameUpdate(CertEntity ce1) {
     try {
         jbInit();
         this.ce=ce1;
     } catch (Exception exception) {
         exception.printStackTrace();
     }
   }


    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        this.setTitle("密钥库密码修改");
        jLabel1.setText("输入新密码:");
        jButton2.setText("返回");
        jButton2.addActionListener(new FrameUpdate_jButton2_actionAdapter(this));
        jButton1.setText("确定");
        jButton1.addActionListener(new FrameUpdate_jButton1_actionAdapter(this));
        jLabel2.setText("输入旧密码:");
    jLabel3.setText("再次输入新密码:");
    oldstorepass.setText("");
    newstorepass.setText("");
    jinggao.setForeground(Color.red);
    jinggao.setText("");
    this.getContentPane().add(jLabel2,  new XYConstraints(83, 39, -1, -1));
    this.getContentPane().add(jLabel1, new XYConstraints(82, 83, -1, -1));
    this.getContentPane().add(jLabel3, new XYConstraints(78, 129, -1, -1));
    this.getContentPane().add(oldstorepass,  new XYConstraints(182, 39, 97, -1));
    this.getContentPane().add(newstorepass, new XYConstraints(181, 81, 98, -1));
    this.getContentPane().add(newstorepassok,    new XYConstraints(182, 127, 100, -1));
    this.getContentPane().add(jinggao,  new XYConstraints(124, 160, 135, 19));
    this.getContentPane().add(jButton1, new XYConstraints(74, 191, 78, -1));
    this.getContentPane().add(jButton2, new XYConstraints(226, 190, 78, -1));
    }
//修改密钥库密码
    public void jButton1_actionPerformed(ActionEvent e) {
         try{
             if(new String(newstorepass.getPassword()).equals(new String(newstorepassok.getPassword())))
             {
               char[] oldpass = oldstorepass.getPassword();
               char[] newpass = newstorepass.getPassword();
               String name = "mykeystore";
               FileInputStream in = new FileInputStream(name);
               KeyStore ks = KeyStore.getInstance("JKS");
               ks.load(in, oldpass);
               in.close();
               FileOutputStream output = new FileOutputStream(name);
               ks.store(output, newpass);
               output.close();
               ce.stroepass=new String(newpass);
               FrameQDown qd = new FrameQDown();
               qd.setSize(400, 350);
               qd.setLocation(312, 234);
               qd.lable1.setText("恭喜您,密码修改成功!");
               qd.lable1.setVisible(true);
               qd.setVisible(true);
               this.dispose();
             }
             else
             {
               jinggao.setText("密码输入不一致,重输!");
             }
          }
          catch(Exception ex)
          {
                System.out.println(ex.getMessage());
          }
    }
//取消
    public void jButton2_actionPerformed(ActionEvent e) {
      this.dispose();
    }
}


class FrameUpdate_jButton2_actionAdapter implements ActionListener {
    private FrameUpdate adaptee;
    FrameUpdate_jButton2_actionAdapter(FrameUpdate adaptee) {
        this.adaptee = adaptee;
    }

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


class FrameUpdate_jButton1_actionAdapter implements ActionListener {
    private FrameUpdate adaptee;
    FrameUpdate_jButton1_actionAdapter(FrameUpdate adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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