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

📄 caeserframe.java~14~

📁 本设计基本上能够实现了课题的要求
💻 JAVA~14~
字号:
package my;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class CaeserFrame extends JFrame {
  JPanel contentPane;
  XYLayout xYLayout1 = new XYLayout();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JScrollPane jScrollPane1 = new JScrollPane();
  JTextArea jTextArea1 = new JTextArea();
  JLabel jLabel1 = new JLabel();
  JScrollPane jScrollPane2 = new JScrollPane();
  JTextArea jTextArea2 = new JTextArea();
  JLabel jLabel2 = new JLabel();
  JScrollPane jScrollPane3 = new JScrollPane();
  JTextArea jTextArea3 = new JTextArea();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  Caeser1 Domm = new Caeser1();

  //Construct the frame
  public CaeserFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  //Component initialization
  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    jButton1.setBackground(new Color(0, 228, 104));
    jButton1.setText("盲目搜索");
    jButton1.addActionListener(new CaeserFrame_jButton1_actionAdapter(this));
    contentPane.setLayout(xYLayout1);
    this.setEnabled(true);
    this.setForeground(Color.black);
    this.setLocale(java.util.Locale.getDefault());
    this.setSize(new Dimension(400, 300));
    this.setTitle("恺撒解密");
    jButton2.setBackground(new Color(255, 152, 255));
    jButton2.setVerifyInputWhenFocusTarget(true);
    jButton2.setText("启发式搜索 ");
    jButton2.addActionListener(new CaeserFrame_jButton2_actionAdapter(this));
    contentPane.setBackground(SystemColor.control);
    contentPane.setFont(new java.awt.Font("Comic Sans MS", 1, 15));
    contentPane.setPreferredSize(new Dimension(348, 55));
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 18));
    jLabel1.setForeground(Color.red);
    jLabel1.setText("  VS.");
    jTextArea1.setText("");
    jTextArea2.setDoubleBuffered(false);
    jTextArea2.setCaretColor(Color.black);
    jTextArea2.setDisabledTextColor(Color.black);
    jTextArea2.setText("jTextArea2");
    jTextArea2.setColumns(0);
    jLabel2.setFont(new java.awt.Font("华文新魏", 1, 15));
    jLabel2.setForeground(new Color(145, 159, 226));
    jLabel2.setText("  说明事项:");
    jTextArea3.setText("jTextArea3");
    jLabel3.setFont(new java.awt.Font("华文新魏", 1, 15));
    jLabel3.setForeground(new Color(0, 111, 145));
    jLabel3.setText("请输入密文:");
    jLabel4.setFont(new java.awt.Font("华文新魏", 1, 15));
    jLabel4.setForeground(new Color(255, 187, 228));
    jLabel4.setText("解密结果:");
    contentPane.add(jScrollPane1,  new XYConstraints(34, 69, 146, 102));
    jScrollPane1.getViewport().add(jTextArea1, null);
    contentPane.add(jScrollPane2,  new XYConstraints(207, 70, 164, 102));
    contentPane.add(jLabel2,  new XYConstraints(37, 185, 118, 24));
    contentPane.add(jScrollPane3, new XYConstraints(33, 209, 343, 78));
    contentPane.add(jButton2, new XYConstraints(245, 5, 95, 28));
    contentPane.add(jButton1, new XYConstraints(59, 5, 87, -1));
    contentPane.add(jLabel1, new XYConstraints(173, 8, 56, 24));
    contentPane.add(jLabel3,   new XYConstraints(30, 42, 112, 22));
    contentPane.add(jLabel4,   new XYConstraints(216, 47, 91, 19));
    jScrollPane3.getViewport().add(jTextArea3, null);
    jScrollPane2.getViewport().add(jTextArea2, null);
  }

  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      //System.exit(0);
      dispose();
    }
  }

  void jButton1_actionPerformed(ActionEvent e) {
    String s = jTextArea1.getText();
    //Caeser1 Domm = new Caeser1();
    Domm.SetText(s);
    Domm.C_Decode();
  //  StringBuffer putout = new StringBuffer();
   // putout=Domm.getout();
    jTextArea2.setText(Domm.getout());
   jTextArea3.setText(Domm.getexplain());
  }

  void jButton2_actionPerformed(ActionEvent e) {
     String s = jTextArea1.getText();
     Domm.SetText(s);
     Domm.C_HDecode();
     jTextArea2.setText(Domm.getout());
  }
}

class CaeserFrame_jButton1_actionAdapter implements java.awt.event.ActionListener {
  CaeserFrame adaptee;

  CaeserFrame_jButton1_actionAdapter(CaeserFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class CaeserFrame_jButton2_actionAdapter implements java.awt.event.ActionListener {
  CaeserFrame adaptee;

  CaeserFrame_jButton2_actionAdapter(CaeserFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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