Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package mao.crypter.demo;
- /**
- *
- * @author leo
- */
- public class GUI extends javax.swing.JFrame {
- private String strString;
- /**
- * Creates new form GUI
- */
- public GUI() {
- initComponents();
- }
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- tfString = new javax.swing.JTextField();
- jLabel1 = new javax.swing.JLabel();
- btCrypt = new javax.swing.JButton();
- btClear = new javax.swing.JButton();
- btEncrypt = new javax.swing.JButton();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jLabel1.setText("Crypter Demo by Mao");
- btCrypt.setText("Crypt");
- btCrypt.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btCryptActionPerformed(evt);
- }
- });
- btClear.setText("Clear");
- btClear.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btClearActionPerformed(evt);
- }
- });
- btEncrypt.setText("Encrypt");
- btEncrypt.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btEncryptActionPerformed(evt);
- }
- });
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(10, 10, 10)
- .addComponent(jLabel1))
- .addGroup(layout.createSequentialGroup()
- .addComponent(btCrypt)
- .addGap(54, 54, 54)
- .addComponent(btClear)
- .addGap(53, 53, 53)
- .addComponent(btEncrypt))
- .addComponent(tfString, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btClear, btCrypt, btEncrypt});
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(48, 48, 48)
- .addComponent(jLabel1)
- .addGap(32, 32, 32)
- .addComponent(tfString, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(31, 31, 31)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btCrypt)
- .addComponent(btClear)
- .addComponent(btEncrypt))
- .addContainerGap(62, Short.MAX_VALUE))
- );
- pack();
- }// </editor-fold>
- private void btClearActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- tfString.setText("");
- }
- private void btCryptActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- String strNew = tfString.getText();
- strString = "";
- for (int i = strNew.length() - 1; i >= 0; i--) {
- strString = strString + strNew.charAt(i);
- }
- System.out.println(" " + strString);
- strString = strString.replace("a", "ñ");
- strString = strString.replace("b", "Å");
- strString = strString.replace("c", "¾");
- strString = strString.replace("d", "┐");
- strString = strString.replace("e", "©");
- strString = strString.replace("f", "€");
- strString = strString.replace("g", "▲");
- strString = strString.replace("h", "zz");
- strString = strString.replace("j", "Ǽ");
- strString = strString.replace("k", "Ə");
- strString = strString.replace("l", "Ѡ");
- strString = strString.replace("m", "Щ");
- strString = strString.replace("n", "З");
- strString = strString.replace("o", "ض");
- strString = strString.replace("%", ">>");
- strString = strString.replace("p", "Ȫ");
- strString = strString.replace("q", "Ʉ");
- strString = strString.replace("r", "Dž");
- strString = strString.replace("s", "ᶈ");
- strString = strString.replace("t", "ḓ");
- strString = strString.replace("u", "Ḕ");
- strString = strString.replace("v", "Ἦ");
- strString = strString.replace("@", "ừ");
- strString = strString.replace("x", "®");
- strString = strString.replace("y", "▀");
- strString = strString.replace("z", "♠");
- strString = strString.replace("-", "!!");
- strString = strString.replace("1", "ᾮ");
- strString = strString.replace("2", "Ḳ");
- strString = strString.replace("3", "ᶎ");
- strString = strString.replace("4", "ᶅ");
- strString = strString.replace("5", "ᵆ");
- strString = strString.replace("6", "ᴨ");
- strString = strString.replace("7", "۞");
- strString = strString.replace("8", "Ԓ");
- strString = strString.replace("9", "Ҧ");
- strString = strString.replace("0", "Ж");
- strString = strString.replace("i", "ζ");
- strString = strString.replace("w", "59");
- strString = strString.replace(".", "+");
- tfString.setText(strString);
- }
- private void btEncryptActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- strString = tfString.getText();
- strString = strString.replace("+", ".");
- strString = strString.replace("59", "w");
- strString = strString.replace("ζ", "i");
- strString = strString.replace("Ж", "0");
- strString = strString.replace("Ҧ", "9");
- strString = strString.replace("Ԓ", "8");
- strString = strString.replace("۞", "7");
- strString = strString.replace("ᴨ", "6");
- strString = strString.replace("ᵆ", "5");
- strString = strString.replace("ᶅ", "4");
- strString = strString.replace("ᶎ", "3");
- strString = strString.replace("Ḳ", "2");
- strString = strString.replace("ᾮ", "1");
- strString = strString.replace("♠", "z");
- strString = strString.replace("▀", "y");
- strString = strString.replace("®", "x");
- strString = strString.replace("ừ", "@");
- strString = strString.replace("Ἦ", "v");
- strString = strString.replace("Ḕ", "u");
- strString = strString.replace("ḓ", "t");
- strString = strString.replace("ᶈ", "s");
- strString = strString.replace("Dž", "r");
- strString = strString.replace("Ʉ", "q");
- strString = strString.replace(">>", "%");
- strString = strString.replace("Ȫ", "p");
- strString = strString.replace("ض", "o");
- strString = strString.replace("З", "n");
- strString = strString.replace("Щ", "m");
- strString = strString.replace("!!", "-");
- strString = strString.replace("Ѡ", "l");
- strString = strString.replace("Ə", "k");
- strString = strString.replace("Ǽ", "j");
- strString = strString.replace("zz", "h");
- strString = strString.replace("▲", "g");
- strString = strString.replace("€", "f");
- strString = strString.replace("©", "e");
- strString = strString.replace("┐", "d");
- strString = strString.replace("¾", "c");
- strString = strString.replace("Å", "b");
- strString = strString.replace("ñ", "a");
- tfString.setText(strString);
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new GUI().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JButton btClear;
- private javax.swing.JButton btCrypt;
- private javax.swing.JButton btEncrypt;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JTextField tfString;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment