Advertisement
Guest User

ff

a guest
Dec 9th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package enigma3;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.BufferedWriter;
  5. import java.io.FileNotFoundException;
  6. import java.io.FileReader;
  7. import java.io.FileWriter;
  8. import java.io.IOException;
  9. import java.io.PrintWriter;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import javax.swing.JFileChooser;
  13. import javax.swing.JOptionPane;
  14.  
  15. public class Crypt extends javax.swing.JFrame {
  16. int rueckgabeWert=0;
  17. JFileChooser chooser = new JFileChooser();
  18.  
  19.     public Crypt() {
  20.         initComponents();
  21.     }
  22.  
  23.  
  24.     @SuppressWarnings("unchecked")
  25.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  26.     private void initComponents() {
  27.  
  28.         jButton1 = new javax.swing.JButton();
  29.         jScrollPane1 = new javax.swing.JScrollPane();
  30.         jTextArea1 = new javax.swing.JTextArea();
  31.         jScrollPane2 = new javax.swing.JScrollPane();
  32.         jTextArea2 = new javax.swing.JTextArea();
  33.         jLabel1 = new javax.swing.JLabel();
  34.         jLabel2 = new javax.swing.JLabel();
  35.         jButton2 = new javax.swing.JButton();
  36.         jButton3 = new javax.swing.JButton();
  37.  
  38.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  39.  
  40.         jButton1.setText("Decrypt");
  41.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  42.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  43.                 jButton1ActionPerformed(evt);
  44.             }
  45.         });
  46.  
  47.         jTextArea1.setColumns(20);
  48.         jTextArea1.setRows(5);
  49.         jScrollPane1.setViewportView(jTextArea1);
  50.  
  51.         jTextArea2.setColumns(20);
  52.         jTextArea2.setRows(5);
  53.         jScrollPane2.setViewportView(jTextArea2);
  54.  
  55.         jLabel1.setText("Input:");
  56.  
  57.         jLabel2.setText("Output");
  58.  
  59.         jButton2.setText("Encrypt");
  60.         jButton2.addActionListener(new java.awt.event.ActionListener() {
  61.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  62.                 jButton2ActionPerformed(evt);
  63.             }
  64.         });
  65.  
  66.         jButton3.setText("Create Key");
  67.         jButton3.addActionListener(new java.awt.event.ActionListener() {
  68.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  69.                 jButton3ActionPerformed(evt);
  70.             }
  71.         });
  72.  
  73.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  74.         getContentPane().setLayout(layout);
  75.         layout.setHorizontalGroup(
  76.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  77.             .addGroup(layout.createSequentialGroup()
  78.                 .addContainerGap()
  79.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  80.                     .addGroup(layout.createSequentialGroup()
  81.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  82.                             .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  83.                             .addComponent(jLabel1)
  84.                             .addComponent(jButton2))
  85.                         .addGap(18, 18, 18)
  86.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  87.                             .addComponent(jButton1)
  88.                             .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  89.                             .addComponent(jLabel2)))
  90.                     .addComponent(jButton3))
  91.                 .addContainerGap(38, Short.MAX_VALUE))
  92.         );
  93.         layout.setVerticalGroup(
  94.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  95.             .addGroup(layout.createSequentialGroup()
  96.                 .addContainerGap()
  97.                 .addComponent(jButton3)
  98.                 .addGap(18, 18, 18)
  99.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  100.                     .addComponent(jButton1)
  101.                     .addComponent(jButton2))
  102.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
  103.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104.                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  105.                         .addComponent(jLabel1)
  106.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  107.                         .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  108.                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  109.                         .addComponent(jLabel2)
  110.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  111.                         .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  112.                 .addContainerGap(34, Short.MAX_VALUE))
  113.         );
  114.  
  115.         pack();
  116.     }// </editor-fold>                        
  117.  
  118.     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  119.     Encrypt();
  120.     }                                        
  121.  
  122.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  123.     Decrypt();
  124.     }                                        
  125.  
  126.     private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  127.     Prozess();
  128.     }                                        
  129.     public void Encrypt(){
  130.         rueckgabeWert = chooser.showOpenDialog(null);
  131.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  132.         {
  133.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  134.                     rueckgabeWert=0;
  135.     try {
  136.         String T= jTextArea1.getText();
  137.         char[] c= T.toCharArray();
  138.         int p=c.length;
  139.         int a1=0;
  140.         int a2=0;
  141.         int a3=0;
  142.         int a4=0;
  143.         int a5=0;
  144.         int a6=0;
  145.         int kl=0;
  146.         boolean b=false;
  147.         int[] i=new int[1000];
  148.         FileReader fe=new FileReader(chooser.getSelectedFile().getPath());
  149.         BufferedReader re =new BufferedReader(fe);
  150.         char[] n=re.readLine().toCharArray();
  151.         int p2=n.length;
  152.         int i2=0;
  153.         for(int l = 0;l<p2;l++){
  154.             String s="";
  155.             for(;n[l]!='|'&&l<p2;l++){
  156.                 s=s+n[l];
  157.             }
  158.             i[i2]= Integer.parseInt(s);
  159.             if(i2<1000)i2++;
  160.             else{
  161.                 b=true;
  162.             }
  163.         }
  164.        
  165.         if(b==true){
  166.             JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  167.             re.close();
  168.         }
  169.         else{
  170.         re.close();
  171.         int[] in = new int[p];
  172.         for(int l = 0;l<p;l++){
  173.             in[l] = LtoN(c[l]);
  174.         }
  175.         for(int l = 0;l<p;l++){
  176.             a6=a5;
  177.             a5=a4;
  178.             a4=a3;
  179.             a3=a2;
  180.             a2=a1;
  181.             a1=in[l];
  182.             in[l]=in[l]+a2;
  183.             if(in[l]>65535){
  184.                 in[l]=in[l]-65535;
  185.             }
  186.             in[l]=in[l]+a3;
  187.             if(in[l]>65535){
  188.                 in[l]=in[l]-65535;
  189.             }
  190.             in[l]=in[l]-a4;
  191.             if(in[l]<1){
  192.                 in[l]=65535+in[l];
  193.             }
  194.             in[l]=in[l]-a5;
  195.             if(in[l]<1){
  196.                 in[l]=65535+in[l];
  197.             }
  198.             in[l]=in[l]+a6;
  199.             if(in[l]>65535){
  200.                 in[l]=in[l]-65535;
  201.             }
  202.             in[l]=in[l]+i[kl];
  203.             if(in[l]>65535){
  204.                 in[l]=in[l]-65535;
  205.             }
  206.             kl++;
  207.             if(kl>999){
  208.                 kl=0;
  209.             }
  210.         }
  211.         String Output="";
  212.         for(int l = 0;l<p;l++){
  213.             Output=Output+NtoL(in[l]);
  214.         }
  215.         jTextArea2.setText(Output);
  216.         }
  217.     } catch (FileNotFoundException ex) {
  218.         JOptionPane.showMessageDialog(rootPane, "No file choosen");
  219.     } catch (IOException ex) {
  220.         JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  221.     }
  222.         }
  223.         else{
  224.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  225.         }
  226.  
  227.     }
  228.     public void Encryptfile(){
  229.         JOptionPane.showMessageDialog(rootPane, "Please select key");
  230.         rueckgabeWert = chooser.showOpenDialog(null);
  231.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  232.         {
  233.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  234.                     rueckgabeWert=0;
  235.     try {
  236.         int a1=0;
  237.         int a2=0;
  238.         int a3=0;
  239.         int a4=0;
  240.         int a5=0;
  241.         int a6=0;
  242.         int kl=0;
  243.         boolean b=false;
  244.         int[] i=new int[1000];
  245.         FileReader fe=new FileReader(chooser.getSelectedFile().getPath());
  246.         BufferedReader re =new BufferedReader(fe);
  247.         chooser.cancelSelection();
  248.         char[] n=re.readLine().toCharArray();
  249.         int p2=n.length;
  250.         int i2=0;
  251.         for(int l = 0;l<p2;l++){
  252.             String s="";
  253.             for(;n[l]!='|'&&l<p2;l++){
  254.                 s=s+n[l];
  255.             }
  256.             i[i2]= Integer.parseInt(s);
  257.             if(i2<1000)i2++;
  258.             else{
  259.                 b=true;
  260.             }
  261.         }
  262.         JOptionPane.showMessageDialog(rootPane, "Please select file to encrypt");
  263.         rueckgabeWert = chooser.showOpenDialog(null);
  264.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  265.         {
  266.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  267.         }
  268.         else{
  269.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  270.             chooser.cancelSelection();
  271.         }
  272.         rueckgabeWert=0;
  273.         FileReader f=new FileReader(chooser.getSelectedFile().getPath());
  274.         BufferedReader r =new BufferedReader(f);
  275.         chooser.cancelSelection();
  276.         char[] c=r.readLine().toCharArray();
  277.         int p=c.length;
  278.         r.close();
  279.        
  280.        
  281.         if(b==true){
  282.             JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  283.             re.close();
  284.         }
  285.         else{
  286.         re.close();
  287.         int[] in = new int[p];
  288.         for(int l = 0;l<p;l++){
  289.             in[l] = LtoN(c[l]);
  290.         }
  291.         for(int l = 0;l<p;l++){
  292.             a6=a5;
  293.             a5=a4;
  294.             a4=a3;
  295.             a3=a2;
  296.             a2=a1;
  297.             a1=in[l];
  298.             in[l]=in[l]+a2;
  299.             if(in[l]>65535){
  300.                 in[l]=in[l]-65535;
  301.             }
  302.             in[l]=in[l]+a3;
  303.             if(in[l]>65535){
  304.                 in[l]=in[l]-65535;
  305.             }
  306.             in[l]=in[l]-a4;
  307.             if(in[l]<1){
  308.                 in[l]=65535+in[l];
  309.             }
  310.             in[l]=in[l]-a5;
  311.             if(in[l]<1){
  312.                 in[l]=65535+in[l];
  313.             }
  314.             in[l]=in[l]+a6;
  315.             if(in[l]>65535){
  316.                 in[l]=in[l]-65535;
  317.             }
  318.             in[l]=in[l]+i[kl];
  319.             if(in[l]>65535){
  320.                 in[l]=in[l]-65535;
  321.             }
  322.             kl++;
  323.             if(kl>999){
  324.                 kl=0;
  325.             }
  326.         }
  327.         String Output="";
  328.         for(int l = 0;l<p;l++){
  329.             Output=Output+NtoL(in[l]);
  330.         }
  331.         JOptionPane.showMessageDialog(rootPane, "Please select result file");
  332.         rueckgabeWert = chooser.showSaveDialog(null);
  333.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  334.         {
  335.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  336.         }
  337.         else{
  338.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  339.             chooser.cancelSelection();
  340.         }
  341.         rueckgabeWert=0;
  342.         PrintWriter writer = new PrintWriter(chooser.getSelectedFile().getPath(), "UTF-8");
  343.         chooser.cancelSelection();
  344.         writer.println(Output);
  345.         writer.close();
  346.         }
  347.     } catch (FileNotFoundException ex) {
  348.         JOptionPane.showMessageDialog(rootPane, "No file choosen");
  349.     } catch (IOException ex) {
  350.         JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  351.     }
  352.         }
  353.         else{
  354.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  355.         }
  356.  
  357.     }
  358.     public void Decrypt(){
  359.         rueckgabeWert = chooser.showOpenDialog(null);
  360.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  361.         {
  362.             rueckgabeWert=0;
  363.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  364.                 try {
  365.         boolean b=false;
  366.         String T= jTextArea1.getText();
  367.         char[] c= T.toCharArray();
  368.         int p=c.length;
  369.         int a2=0;
  370.         int a3=0;
  371.         int a4=0;
  372.         int a5=0;
  373.         int a6=0;
  374.         int kl=0;
  375.         int[] i=new int[1000];
  376.         FileReader fe=new FileReader(chooser.getSelectedFile().getPath());
  377.         BufferedReader re =new BufferedReader(fe);
  378.         chooser.cancelSelection();
  379.         char[] n=re.readLine().toCharArray();
  380.         int p2=n.length;
  381.         int i2=0;
  382.         for(int l = 0;l<p2;l++){
  383.             String s="";
  384.             for(;n[l]!='|'&&l<p2;l++){
  385.                 s=s+n[l];
  386.             }
  387.             i[i2]= Integer.parseInt(s);
  388.             if(i2<1000)i2++;
  389.             else{
  390.                 b=true;
  391.             }
  392.         }
  393.         if(b==true){
  394.             JOptionPane.showMessageDialog(rootPane, "Error at reading data from file"+i[99]);
  395.             re.close();
  396.         }
  397.         else{
  398.         re.close();
  399.         int[] in = new int[p];
  400.         for(int l = 0;l<p;l++){
  401.             in[l] = LtoN(c[l]);
  402.         }
  403.         for(int l = 0;l<p;l++){
  404.             in[l]=in[l]-i[kl];
  405.             if(in[l]<1){
  406.                 in[l]=in[l]+65535;
  407.             }
  408.             kl++;
  409.             if(kl>999){
  410.                 kl=0;
  411.             }
  412.             in[l]=in[l]-a2;
  413.             if(in[l]<1){
  414.                 in[l]=65535+in[l];
  415.             }
  416.             in[l]=in[l]-a3;
  417.             if(in[l]<1){
  418.                 in[l]=65535+in[l];
  419.             }
  420.             in[l]=in[l]+a4;
  421.             if(in[l]>65535){
  422.                 in[l]=in[l]-65535;
  423.             }
  424.             in[l]=in[l]+a5;
  425.             if(in[l]>65535){
  426.                 in[l]=in[l]-65535;
  427.             }
  428.             in[l]=in[l]-a6;
  429.             if(in[l]<1){
  430.                 in[l]=65535+in[l];
  431.             }
  432.             a6=a5;
  433.             a5=a4;
  434.             a4=a3;
  435.             a3=a2;
  436.             a2=in[l];
  437.            
  438.            
  439.         }
  440.         String Output="";
  441.         for(int l = 0;l<p;l++){
  442.             Output=Output+NtoL(in[l]);
  443.         }
  444.         jTextArea2.setText(Output);
  445.         }
  446.     } catch (FileNotFoundException ex) {
  447.         JOptionPane.showMessageDialog(rootPane, "No file choosen");
  448.     } catch (IOException ex) {
  449.         JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  450.     }
  451.         }
  452.         else{
  453.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  454.             rueckgabeWert=0;
  455.             chooser.cancelSelection();
  456.         }
  457.  
  458.     }
  459.     public void Decryptfile(){
  460.         rueckgabeWert = chooser.showOpenDialog(null);
  461.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  462.         {
  463.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  464.             rueckgabeWert=0;
  465.                 try {
  466.         boolean b=false;
  467.         int a2=0;
  468.         int a3=0;
  469.         int a4=0;
  470.         int a5=0;
  471.         int a6=0;
  472.         int kl=0;
  473.         int[] i=new int[1000];
  474.         FileReader fe=new FileReader(chooser.getSelectedFile().getPath());
  475.         BufferedReader re =new BufferedReader(fe);
  476.         chooser.cancelSelection();
  477.         char[] n=re.readLine().toCharArray();
  478.         int p2=n.length;
  479.         int i2=0;
  480.         for(int l = 0;l<p2;l++){
  481.             String s="";
  482.             for(;n[l]!='|'&&l<p2;l++){
  483.                 s=s+n[l];
  484.             }
  485.             i[i2]= Integer.parseInt(s);
  486.             if(i2<1000)i2++;
  487.             else{
  488.                 b=true;
  489.             }
  490.         }
  491.         if(b==true){
  492.             JOptionPane.showMessageDialog(rootPane, "Error at reading data from file"+i[99]);
  493.             re.close();
  494.         }
  495.         else{
  496.         re.close();
  497.         JOptionPane.showMessageDialog(rootPane, "Please select file to decrypt");
  498.         rueckgabeWert = chooser.showOpenDialog(null);
  499.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  500.         {
  501.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  502.         }
  503.         else{
  504.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  505.             chooser.cancelSelection();
  506.         }
  507.         rueckgabeWert=0;
  508.         FileReader f=new FileReader(chooser.getSelectedFile().getPath());
  509.         BufferedReader r =new BufferedReader(f);
  510.         chooser.cancelSelection();
  511.         char[] c=r.readLine().toCharArray();
  512.         int p=c.length;
  513.         r.close();
  514.         int[] in = new int[p];
  515.         for(int l = 0;l<p;l++){
  516.             in[l] = LtoN(c[l]);
  517.         }
  518.         for(int l = 0;l<p;l++){
  519.             in[l]=in[l]-i[kl];
  520.             if(in[l]<1){
  521.                 in[l]=in[l]+65535;
  522.             }
  523.             kl++;
  524.             if(kl>999){
  525.                 kl=0;
  526.             }
  527.             in[l]=in[l]-a2;
  528.             if(in[l]<1){
  529.                 in[l]=65535+in[l];
  530.             }
  531.             in[l]=in[l]-a3;
  532.             if(in[l]<1){
  533.                 in[l]=65535+in[l];
  534.             }
  535.             in[l]=in[l]+a4;
  536.             if(in[l]>65535){
  537.                 in[l]=in[l]-65535;
  538.             }
  539.             in[l]=in[l]+a5;
  540.             if(in[l]>65535){
  541.                 in[l]=in[l]-65535;
  542.             }
  543.             in[l]=in[l]-a6;
  544.             if(in[l]<1){
  545.                 in[l]=65535+in[l];
  546.             }
  547.             a6=a5;
  548.             a5=a4;
  549.             a4=a3;
  550.             a3=a2;
  551.             a2=in[l];
  552.            
  553.            
  554.         }
  555.         String Output="";
  556.         for(int l = 0;l<p;l++){
  557.             Output=Output+NtoL(in[l]);
  558.         }
  559.         JOptionPane.showMessageDialog(rootPane, "Please select result file");
  560.         rueckgabeWert = chooser.showSaveDialog(null);
  561.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  562.         {
  563.             JOptionPane.showMessageDialog(rootPane, "Successfully loaded");
  564.         }
  565.         else{
  566.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  567.             chooser.cancelSelection();
  568.         }
  569.         rueckgabeWert=0;
  570.         PrintWriter writer = new PrintWriter(chooser.getSelectedFile().getPath(), "UTF-8");
  571.         chooser.cancelSelection();
  572.         writer.println(Output);
  573.         writer.close();
  574.         }
  575.     } catch (FileNotFoundException ex) {
  576.         JOptionPane.showMessageDialog(rootPane, "No file choosen");
  577.     } catch (IOException ex) {
  578.         JOptionPane.showMessageDialog(rootPane, "Error at reading data from file");
  579.     }
  580.         }
  581.         else{
  582.             JOptionPane.showMessageDialog(rootPane, "No file selected");
  583.             rueckgabeWert=0;
  584.             chooser.cancelSelection();
  585.         }
  586.     }
  587.     public char NtoL(int i){
  588.         char c = (char)i;
  589.         return c;
  590.     }
  591.     public int LtoN(char c){
  592.        int i = (int) c;
  593.        return i;
  594.     }
  595.     public void Prozess(){
  596.         JFileChooser chooser = new JFileChooser();
  597.         int rueckgabeWert = chooser.showSaveDialog(null);
  598.         if(rueckgabeWert == JFileChooser.APPROVE_OPTION)
  599.         {
  600.             System.out.println(chooser.getSelectedFile().getPath());
  601.             try{
  602.             FileWriter fw = new FileWriter(chooser.getSelectedFile().getPath());
  603.             BufferedWriter bw = new BufferedWriter(fw);
  604.             for(int i=0;i<1000;i++){
  605.                 int n=(int) ((Math.random()*65534)+1);
  606.                 System.out.println(n);
  607.                 String s=""+n;
  608.                 bw.write(s);
  609.                 bw.write("|");
  610.             }
  611.             bw.close();
  612.             JOptionPane.showMessageDialog(rootPane, "Sucessfull");
  613.             }
  614.             catch(IOException ioe){
  615.                
  616.             }
  617.         }
  618.  
  619.     }
  620.     public void start(){
  621.         try {
  622.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  623.                 if ("Nimbus".equals(info.getName())) {
  624.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  625.                     break;
  626.                 }
  627.             }
  628.         } catch (ClassNotFoundException ex) {
  629.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  630.         } catch (InstantiationException ex) {
  631.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  632.         } catch (IllegalAccessException ex) {
  633.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  634.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  635.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  636.         }
  637.         //</editor-fold>
  638.  
  639.         /* Create and display the form */
  640.         java.awt.EventQueue.invokeLater(new Runnable() {
  641.             public void run() {
  642.                 new Crypt().setVisible(true);
  643.             }
  644.         });
  645.     }
  646.     public static void main(String args[]) {
  647.         try {
  648.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  649.                 if ("Nimbus".equals(info.getName())) {
  650.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  651.                     break;
  652.                 }
  653.             }
  654.         } catch (ClassNotFoundException ex) {
  655.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  656.         } catch (InstantiationException ex) {
  657.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  658.         } catch (IllegalAccessException ex) {
  659.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  660.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  661.             java.util.logging.Logger.getLogger(Crypt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  662.         }
  663.         //</editor-fold>
  664.         java.awt.EventQueue.invokeLater(new Runnable() {
  665.             public void run() {
  666.                 new Crypt().setVisible(true);
  667.             }
  668.         });
  669.     private javax.swing.JButton jButton1;
  670.     private javax.swing.JButton jButton2;
  671.     private javax.swing.JButton jButton3;
  672.     private javax.swing.JLabel jLabel1;
  673.     private javax.swing.JLabel jLabel2;
  674.     private javax.swing.JScrollPane jScrollPane1;
  675.     private javax.swing.JScrollPane jScrollPane2;
  676.     private javax.swing.JTextArea jTextArea1;
  677.     private javax.swing.JTextArea jTextArea2;              
  678. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement