Advertisement
Nattack

schoolstuff

Jul 12th, 2017
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1.         // attach listeners to each of the buttons and the key text field
  2.         //      use lambda expressions
  3.         encrypt.addActionListener( e -> output.setText(secrets.encrypt(key.getText(), msg.getText())) );
  4.         decrypt.addActionListener( e -> output.setText(secrets.decrypt(key.getText(), msg.getText())) );
  5.         key.addActionListener( e -> {
  6.             if (secrets.getState() == Secrets.State.LOCKED) {
  7.               secrets.unlock(key.getText());
  8.               output.setText(secrets.getMessage());
  9.             }
  10.         } );
  11.         buttonA.addActionListener( e -> {
  12.           secrets.unlock(buttonA.getText());
  13.           output.setText(secrets.getMessage());
  14.         } );
  15.         buttonB.addActionListener( e -> {
  16.           secrets.unlock(buttonB.getText());
  17.           output.setText(secrets.getMessage());
  18.         } );
  19.         buttonC.addActionListener( e -> {
  20.           secrets.unlock(buttonC.getText());
  21.           output.setText(secrets.getMessage());
  22.         } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement