Example #1
0
  /**
   * Pop-up a Dialog if the source and backup fields are the same. Returns true if the source and
   * backup remain the same.
   */
  private boolean testSourceVsBackup() {
    if (dirTF.getText().equals(backupTF.getText())) {
      final String caption = ResourceHandler.getMessage("caption.warning");

      MessageFormat formatter =
          new MessageFormat(ResourceHandler.getMessage("warning_dialog.info"));
      final String info = formatter.format(new Object[] {backupTF.getText()});

      int n = JOptionPane.showConfirmDialog(this, info, caption, JOptionPane.WARNING_MESSAGE);

      if (n == JOptionPane.YES_OPTION) {
        backupTF.setText(backupTF.getText() + "_BAK");

        return false;
      } else if (n == JOptionPane.NO_OPTION) return true;
    }

    return false;
  }