/** Makes sure that the right row is selected on adding a new record, or on editing a record. */
  private void selectRow() {

    int tableRows = tableData.getRowCount();
    int tabelCols = tableData.getColumnCount();
    int rowToSelect = 0;

    if (recordEdited != -1) {
      rowToSelect = recordEdited; // Select the edited record
    } else {
      for (int i = 0; i < tableRows; i++) {
        String companyName = (String) tableData.getValueAt(i, 1);
        if (companyName.equals("-")) {
          rowToSelect = i; // Select the new record
        }
      }
    }

    insuranceCompaniesTable.setRowSelectionInterval(rowToSelect, rowToSelect);
  }