Esempio n. 1
0
 @Override
 public void actionPerformed(ActionEvent ae) {
   try {
     String action = ae.getActionCommand();
     switch (action) {
       case "sign":
         String message = messageField.getText();
         if (message.length() == 0) {
           UIRes.showErrorMessage(this, "Error", "You must enter the message text to sign");
         } else {
           int index = nameField.getSelectedIndex();
           ECKey key = BTCLoader.keys.get(index);
           String signature = key.signMessage(message);
           signatureField.setText(signature);
         }
         break;
       case "copy":
         String signature = signatureField.getText();
         StringSelection sel = new StringSelection(signature);
         Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
         cb.setContents(sel, null);
         break;
       case "done":
         setVisible(false);
         dispose();
         break;
     }
   } catch (ECException exc) {
     ErrorLog.get().logException("Unable to sign message", exc);
   } catch (Exception exc) {
     ErrorLog.get().logException("Exception while processing action event", exc);
   }
 }
Esempio n. 2
0
 public static void showDialog(JDialog parent) {
   try {
     JDialog dialog = new SignDialog(parent);
     dialog.pack();
     dialog.setLocationRelativeTo(parent);
     dialog.setVisible(true);
   } catch (Exception exc) {
     ErrorLog.get().logException("Exception while displaying dialog", exc);
   }
 }