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

📄 encryptionface.java~185~

📁 文件加密软件
💻 JAVA~185~
字号:
package com.borland.samples.welcome;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import java.awt.BorderLayout;

public class EncryptionFace extends JFrame {
  GridBagLayout gbl = new GridBagLayout();
  JPanel jpanel = new JPanel(gbl);
  CheckboxGroup cbg=new CheckboxGroup();
  JRadioButton easyRadioButton = new JRadioButton();
  JRadioButton allRadioButton  = new JRadioButton();
  JRadioButton copeRadioButton = new JRadioButton();
  ButtonGroup group = new ButtonGroup();
  JLabel fileOrFolderlabel = new JLabel();
  JTextField fileOrFolderTextField = new JTextField();
  JButton openButton = new JButton();
  JLabel passwordLabel = new JLabel();
  JPasswordField passwordField = new JPasswordField();
  JButton copeButton = new JButton();
  JLabel messageLabel = new JLabel();
  JScrollPane jsp;
  JTextArea messageTextArea1 = new JTextArea(10,20);
  public EncryptionFace() {
    try {
      init();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    try {
      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  private void init() throws Exception {
    getContentPane().setLayout(new BorderLayout());
    setTitle("文件加密");
    setSize(new Dimension(500, 500));
    //setIconImage(getToolkit().createImage(getClass().getResource("res/frameIcon.gif")));
  }
  /**
   * 本窗口事件
   * @param e WindowEvent
   */
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }

  private void jbInit() throws Exception {
    easyRadioButton.setSelected(true);
    easyRadioButton.setText("简单加密  (适用于尺寸较小的文本文件,如:txt、c/c++、sql等)");
    allRadioButton.setText ("全面加密  (适用于固定格式的二进制文件,如:exe、ram、jpg等)");
    copeRadioButton.setActionCommand("文件解密                                 ");
    group.add(easyRadioButton);
    group.add(allRadioButton);
    group.add(copeRadioButton);
    copeRadioButton.setText("文件解密                                             ");
    fileOrFolderlabel.setText("    文件/文件夹");
    openButton.setText("打  开");
    openButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        openButton_actionPerformed(e);
      }
    });
    passwordLabel.setText("密             码 ");
    copeButton.setText("加/解密");
    copeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        copeButton_actionPerformed(e);
      }
    });
    messageLabel.setText("       文件处理信息");
    jsp = new JScrollPane(messageTextArea1);
    messageTextArea1.setEditable(false);
    jpanel.add(allRadioButton,
                              new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0
        , GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
        new Insets(0, 2, 0, 0), 0, 0));
    jpanel.add(fileOrFolderlabel,
                              new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
        , GridBagConstraints.CENTER, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 0), 0, 0));
    jpanel.add(easyRadioButton,
                              new GridBagConstraints(0, 0, 4, 1, 0.0, 0.0
        , GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE,
        new Insets(0, 2, 0, 1), 20, 0));
    jpanel.add(copeButton,
                              new GridBagConstraints(2, 4, 2, 1, 0.0, 0.0
        , GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 3, 3, 1), 3, -8));
    jpanel.add(messageLabel,
                              new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
        , GridBagConstraints.CENTER, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 0), 0, 0));

    jpanel.add(openButton,
                              new GridBagConstraints(2, 3, 2, 1, 0.0, 0.0
        , GridBagConstraints.WEST, GridBagConstraints.NONE,
        new Insets(0, 3, 0, 2), 13, -7));

    jpanel.add(passwordField,
                              new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0
        , GridBagConstraints.CENTER, GridBagConstraints.NONE,
        new Insets(0, 3, 0, 4), 201, 0));

    jpanel.add(fileOrFolderTextField,
                              new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
        , GridBagConstraints.CENTER, GridBagConstraints.NONE,
        new Insets(0, 1, 0, 1), 201, 0));
    jpanel.add(copeRadioButton,
                              new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0
        , GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE,
        new Insets(0, 2, 0, 11), 37, 0));

    jpanel.add(passwordLabel,
                              new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
        , GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 0), 10, 0));
    this.getContentPane().add(jpanel,BorderLayout.NORTH);
    this.getContentPane().add(jsp, java.awt.BorderLayout.SOUTH);
  }

  public void openButton_actionPerformed(ActionEvent e) {
    System.out.println(easyRadioButton.isSelected());
    System.out.println(allRadioButton.isSelected());
    System.out.println(copeRadioButton.isSelected());
  }
  public void copeButton_actionPerformed(ActionEvent e) {
    System.out.println(easyRadioButton.isSelected());
    System.out.println(allRadioButton.isSelected());
    System.out.println(copeRadioButton.isSelected());
}

}

⌨️ 快捷键说明

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