Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // attach listeners to each of the buttons and the key text field
- // use lambda expressions
- encrypt.addActionListener( e -> output.setText(secrets.encrypt(key.getText(), msg.getText())) );
- decrypt.addActionListener( e -> output.setText(secrets.decrypt(key.getText(), msg.getText())) );
- key.addActionListener( e -> {
- if (secrets.getState() == Secrets.State.LOCKED) {
- secrets.unlock(key.getText());
- output.setText(secrets.getMessage());
- }
- } );
- buttonA.addActionListener( e -> {
- secrets.unlock(buttonA.getText());
- output.setText(secrets.getMessage());
- } );
- buttonB.addActionListener( e -> {
- secrets.unlock(buttonB.getText());
- output.setText(secrets.getMessage());
- } );
- buttonC.addActionListener( e -> {
- secrets.unlock(buttonC.getText());
- output.setText(secrets.getMessage());
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement