コード例 #1
0
  private void enterPasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // ask user to enter pairing password
    final JTextField manualPassword = new JTextField();
    manualPassword.setText(bundle.getString("PairThisDeviceDialog.enterPW"));
    manualPassword.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            if (manualPassword.getText().equals(bundle.getString("PairThisDeviceDialog.enterPW"))) {
              manualPassword.setText("");
            }
          }
        });
    JOptionPane.showMessageDialog(
        this,
        manualPassword,
        bundle.getString("PairThisDeviceDialog.enterPairingPW"),
        JOptionPane.INFORMATION_MESSAGE);

    // check if password is valid
    String text = manualPassword.getText();
    if (isPanboxQRCode(text)) {
      logger.debug(
          "PairThisDeviceDialog : enterPasswordButtonActionPerformed : Entered Password is a valid PanboxQRCodePassword. Will simulate QR scan...");
      qrCodeDetected(text);
    } else {
      logger.debug(
          "PairThisDeviceDialog : enterPasswordButtonActionPerformed : Entered Password is an invalid PanboxQRCodePassword. Will abort.");
      JOptionPane.showMessageDialog(
          this, "The entered password was not a valid Panbox pairing password. Please try again.");
    }
  }
コード例 #2
0
 private void camComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
   CameraDevice dev = (CameraDevice) camComboBox.getModel().getSelectedItem();
   logger.debug("PairThisDeviceDialog : camComboBoxActionPerformed : New device: " + dev);
   // TODO: update camera view with new device!
   // FIXME: I18N when this is changed
   JOptionPane.showMessageDialog(this, "Switching between devices is currently not supported!");
 }