private void menuRenameColsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRenameColsActionPerformed
    // get selected columns and check for empty selection
    int[] selected_cols = getSelectedColumns();
    if (selected_cols.length == 0)
      throw new IllegalArgumentException("Empty column selection.");
    // ask for a new column name
    String rootName = JOptionPane.showInputDialog(this,
            "Insert new column name", "Rename column(s)...",
            JOptionPane.QUESTION_MESSAGE);
    // check if rename operation was aborted
    if (rootName == null) return;
    // check if all column names are valid
    String columnName = rootName;
    String error_log = new String();
    boolean error_state = false;
    for (int i = 0; i < selected_cols.length; i++)
    {
      if (selected_cols.length != 1) columnName = rootName + (i + 1);
      // generate an error message if column name is not valid
      if (!table.isColumnNameValid(columnName))
      {
        error_state = true;
        error_log += "ERROR: " + (columnName.isEmpty()
                ? "Empty name" : "\"" + columnName + "\"\n");
      }
    }
    // show an error message with details of unvalid column names
    if (error_state)
    {
      JOptionPane.showMessageDialog(this,
              "Column name(s) must be unique inside the table and "
              + "cannot be empty.\n\n" + error_log,
              "Invalid column name(s)",
              JOptionPane.ERROR_MESSAGE);
      return;
    }
    // for each selected column change column name
    columnName = rootName;
    for (int i = 0; i < selected_cols.length; i++)
    {
      if (selected_cols.length != 1) columnName = rootName + (i + 1);
      // change column name in the table and update TableColumnModel
      table.setColumnName(selected_cols[i], columnName);
      TableColumn column = mainTable.getColumnModel()
              .getColumn(selected_cols[i]);
      column.setHeaderValue(columnName);
    }
    // update main table and column list
    mainTable.getTableHeader().updateUI();
    listColumns.updateUI();
  }//GEN-LAST:event_menuRenameColsActionPerformed