code: private void settingsSaveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_settingsSaveMenuItemActionPerformed
          if (settingsFile == null) {
              settingsSaveAsMenuItemActionPerformed(evt);
          } else {
              if (settingsFile.exists()) {
                  int response = JOptionPane.showConfirmDialog(this,
                          "Overwrite existing file \"" + settingsFile + "\"?", "Confirm Overwrite",
                          JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                  if (response == JOptionPane.CANCEL_OPTION) {
                      settingsSaveAsMenuItemActionPerformed(evt);
                      return;
                  }
              }
  
              try {
                  saveSettings(settingsFile);
              } catch (IOException ex) {
                  Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE,
                          "Could not save settings to \"" + settingsFile + "\"", ex);
              }
          }
      }
docs: GEN-LAST:event_settingsLoadMenuItemActionPerformed