LAMPIRAN A: LISTING PROGRAM TampilanUtama.java
LAMPIRAN A: LISTING PROGRAM TampilanUtama.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; /* >
- @author rimavirgie
- / public class TampilanutamavigenereLFSR extends javax.swing.JFrame { public TampilanutamavigenereLFSR() { initComponents(); this.setLocationRelativeTo(getRootPane());//untuk menampilkan ketengah } /**
- 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() { jLabel4 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(178, 178, 178)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(190, 190, 190)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5) .addContainerGap(100, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) { Enkripsi enkrip = new Enkripsi();//untuk memanggil kelas enkrip enkrip.show();//menampilkan this.dispose(); //untuk menutup menu sebelumnya } private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) { Dekripsi dekrip = new Dekripsi () ;//untuk memanggil kelas dekrip dekrip.show();//menampilkan this.dispose();//untuk menutup menu sebelumnya } private void editMenuActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void editMenuMouseClicked(java.awt.event.MouseEvent evt) { About about = new About();//untuk memanggil kelas about about.show();//untuk menampilkan } private void helpMenuMouseClicked(java.awt.event.MouseEvent evt) { MenuHelp help = new MenuHelp();//untuk menampilkan kelas menu help.show();//untuk menampilakan this.dispose();//untuk menutup menu sebelumnya } /**
- @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.h tml
- / 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(TampilanutamavigenereLFSR.class.ge tName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TampilanutamavigenereLFSR.class.ge tName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TampilanutamavigenereLFSR.class.ge tName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TampilanutamavigenereLFSR.class.ge tName()).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 TampilanutamavigenereLFSR().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JMenu editMenu; private javax.swing.JMenu fileMenu; private javax.swing.JMenu helpMenu; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JMenuBar menuBar; private javax.swing.JMenuItem openMenuItem; private javax.swing.JMenuItem saveMenuItem; // End of variables declaration }
Enkripsi.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level;
- @author rimavirgie
- / public class Enkripsi extends javax.swing.JFrame { // deklarasi variabel String key,enkripsi,plainteks; /**
- Creates new form Enkripsi */ public Enkripsi() { initComponents(); this.setLocationRelativeTo(getRootPane());//untuk menampilkan ketengah } /**
- 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() { jMenuBar2 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); jMenu4 = new javax.swing.JMenu(); jMenuBar3 = new javax.swing.JMenuBar();
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 122, Short.MAX_VALUE) .addComponent(jButton2) .addGap(76, 76, 76)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jButton5) .addGap(148, 148, 148)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(145, 145, 145)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup()
.addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.BASELINE) .addComponent(ValueKey, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)))) .addGap(18, 18, 18) .addComponent(jButton4) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.BASELINE) .addComponent(jLabel2) .addComponent(Plain, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jButton5) .addGap(59, 59, 59) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jLabel3) .addComponent(cipher, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jButton2) .addComponent(jButton3)) .addContainerGap(13, Short.MAX_VALUE))
); pack(); }// </editor-fold> private void ValueKeyActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void cipherActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { LFSR lfsr = new LFSR();//untuk memanggil kelas lfsr key = lfsr.generateKey(13);//memanggil method generate key pada kelas lfsr ValueKey.setText(key); } private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { plainteks = Plain.getText(); enkripsi = VigenereLFSR.encrypt(plainteks, ValueKey.getText()); cipher.setText(enkripsi); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { TampilanutamavigenereLFSR menu = new TampilanutamavigenereLFSR(); menu.show(); this.dispose(); // TODO add your handling code here: } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
FileWriter fw = null; try { String nmfile = "cipherteks.txt"; fw = new FileWriter(nmfile); BufferedWriter bw = new BufferedWriter(fw); String isiText=""; String nilaiN=""; isiText = cipher.getText(); bw.write(isiText); bw.newLine(); bw.close(); fw.close(); JOptionPane.showMessageDialog(rootPane, "Cipherteks disimpan di D:\\vigenerecipherlfsr"); } catch (IOException ex) { Logger.getLogger(Enkripsi.class.getName()).log(Level.SEVERE, null, ex); } } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { FileWriter fw = null; try { String nmfile = "Key.txt"; fw = new FileWriter(nmfile); BufferedWriter bw = new BufferedWriter(fw); //Membuat objek untuk memils file String isiText=""; isiText = ValueKey.getText(); bw.write(isiText); bw.close(); fw.close(); JOptionPane.showMessageDialog(rootPane, "nilai key di simpan di D:\\vigenerecipherlfsr"); } catch (IOException ex) { Logger.getLogger(Enkripsi.class.getName()).log(Level.SEVERE, null, ex); } } /**
- @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.h tml
- / 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(Enkripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Enkripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Enkripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Enkripsi.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 Enkripsi().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField Plain; private javax.swing.JTextField ValueKey; private javax.swing.JTextField cipher; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JMenu jMenu3; private javax.swing.JMenu jMenu4; private javax.swing.JMenu jMenu5; private javax.swing.JMenu jMenu6; private javax.swing.JMenuBar jMenuBar2; private javax.swing.JMenuBar jMenuBar3; private javax.swing.JTextField jTextField2; // End of variables declaration }
Dekripsi.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** >@author rimavirgie
- / public class Dekripsi extends javax.swing.JFrame { String dekrip, fil;
/**
- Creates new form Dekripsi */ public Dekripsi() { initComponents(); this.setLocationRelativeTo(getRootPane());//untuk menampilkan ketengah } /**
- 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() { jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); txtcipher = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txtkey = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); txtdekrip = new javax.swing.JTextField(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Traditional Arabic", 1, 12)); // NOI18N
.addContainerGap()))))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(162, 162, 162) .addComponent(jButton2)) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addComponent(jButton3))) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(txtcipher, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jButton4))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.TRAILING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(5, 5, 5)))) .addGap(18, 18, 18) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.BASELINE) .addComponent(jLabel3) .addComponent(txtdekrip, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3) .addGap(14, 14, 14)) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { FileChooser file = new FileChooser(); try { fil = file.Browse(); } catch (IOException ex) { Logger.getLogger(Enkripsi.class.getName()).log(Level.SEVERE, null, ex);
} txtkey.setText(fil); } private void txtcipherActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { VigenereLFSR dekripsi = new VigenereLFSR(); dekrip = dekripsi.decrypt(txtcipher.getText(), txtkey.getText()); txtdekrip.setText(dekrip); // TODO add your handling code here: } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { TampilanutamavigenereLFSR menu = new TampilanutamavigenereLFSR(); menu.show(); this.dispose(); // TODO add your handling code here: } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { FileChooser file = new FileChooser(); try { fil = file.Browse(); } catch (IOException ex) { Logger.getLogger(Enkripsi.class.getName()).log(Level.SEVERE, null, ex);
} txtcipher.setText(fil); } /**
- @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.h tml
- / 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(Dekripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Dekripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Dekripsi.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Dekripsi.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 Dekripsi().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JTextField txtcipher; private javax.swing.JTextField txtdekrip; private javax.swing.JTextField txtkey; // End of variables declaration }
About.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; /** >@author rimavirgie
- / public class About extends javax.swing.JFrame { /**
- Creates new form About */ public About() { initComponents(); this.setLocationRelativeTo(getRootPane());//untuk menampilkan ketengah } /**
- 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() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel();
INI DIRANCANG"); jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel4.setText(" UNTUK MEMENUHI TUGAS AKHIR DI FAKULTAS S1
ILMU KOMPUTER"); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jButton1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N jButton1.setText("OK"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel7.setIcon(new javax.swing.ImageIcon("C:\\Users\\rimavirgie\\Desktop\\Capture.PNG")) ; // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jLabel3) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2)) .addComponent(jLabel4))) .addGroup(layout.createSequentialGroup() .addGap(63, 63, 63) .addComponent(jLabel5) .addGap(61, 61, 61) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(20, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE) .addComponent(jButton1) .addGap(198, 198, 198)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.BASELINE) .addComponent(jLabel1) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel4) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(73, 73, 73) .addComponent(jLabel5) .addContainerGap(167, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jButton1) .addGap(12, 12, 12)))) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { this.dispose(); } /**
- @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.h tml
- / try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) {
LFSR.java VigenereLFSR.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; /** >@author rimavirgie
- / public class VigenereLFSR { private static final String table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789."; public static String encrypt(String plain, String key){ key = key + plain; String cipher = ""; int i, p, k, c; for (i = 0; i < plain.length(); i++) { p = table.indexOf(plain.charAt(i)); k = table.indexOf(key.charAt(i));
System.out.println("ciphertext = " + cipher); System.out.println("decryptedtext = " + decrypted); } }
FileChooser.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFileChooser; /**
- @author rimavirgie
- / public class FileChooser { public static String Browse() throws FileNotFoundException,
IOException { String str = ""; JFileChooser chooser=new JFileChooser(); int returnVal = chooser.showOpenDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) { BufferedReader br = null; File f = chooser.getSelectedFile(); br = new BufferedReader(new FileReader(f)); String st=""; while((st=br.readLine())!=null){ str += st; } br.close(); } return str; } }
MenuHelp.java
/*
- To change this template, choose Tools | Templates * and open the template in the editor.
- / package vigenerecipherlfsr; public class MenuHelp extends javax.swing.JFrame { /**
- Creates new form MenuHelp
- / public MenuHelp() { initComponents(); this.setLocationRelativeTo(getRootPane());//untuk menampilkan ketengah } /**
- 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() { jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jLabel2.setText("jLabel2"); jButton1.setText("jButton1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N jLabel1.setText("Tampilan menu enkripsi"); jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N jLabel3.setText("1.Key : befungsi untuk membangkitkan kunci");
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.TRAILING, false) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup()
.addGap(71, 71, 71) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignmen t.LEADING) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(71, 71, 71) .addComponent(jButton2))))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(13, 13, 13) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel3) .addGap(13, 13, 13) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel9)
.addGap(18, 18, 18) .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ) .addComponent(jLabel11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { TampilanutamavigenereLFSR menu = new TampilanutamavigenereLFSR(); menu.show(); this.dispose(); } /**
- @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.h tml
- / try {