?? caeserframe.java
字號:
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, 450));
this.setTitle("愷撒解密");
jButton2.setBackground(new Color(255, 152, 255));
jButton2.setVerifyInputWhenFocusTarget(true);
jButton2.setActionCommand("啟發式搜索 ");
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.setColumns(0);
jLabel2.setFont(new java.awt.Font("華文新魏", 1, 15));
jLabel2.setForeground(new Color(145, 159, 226));
jLabel2.setText(" 說明事項:");
jLabel3.setFont(new java.awt.Font("華文新魏", 1, 15));
jLabel3.setForeground(new Color(0, 145, 145));
jLabel3.setText("請輸入密文:");
jLabel4.setFont(new java.awt.Font("華文新魏", 1, 15));
jLabel4.setForeground(new Color(0, 145, 145));
jLabel4.setText("解密結果:");
jTextArea3.setText("");
contentPane.add(jScrollPane3, new XYConstraints(27, 300, 343, 113));
contentPane.add(jLabel2, new XYConstraints(26, 269, 118, 24));
contentPane.add(jScrollPane1, new XYConstraints(27, 140, 151, 108));
contentPane.add(jLabel3, new XYConstraints(25, 106, 112, 22));
contentPane.add(jScrollPane2, new XYConstraints(204, 138, 164, 109));
contentPane.add(jLabel4, new XYConstraints(205, 108, 91, 19));
contentPane.add(jLabel1, new XYConstraints(161, 52, 56, 24));
contentPane.add(jButton1, new XYConstraints(44, 44, 101, 39));
contentPane.add(jButton2, new XYConstraints(236, 43, 107, 36));
jScrollPane2.getViewport().add(jTextArea2, null);
jScrollPane1.getViewport().add(jTextArea1, null);
jScrollPane3.getViewport().add(jTextArea3, 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(1);
jTextArea2.setText(Domm.getout());
jTextArea3.setText(Domm.getexplain());
}
}
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 + -