// If a table cell is being edited, we should accept the current
// value and stop the editing before adding a new row.
if (headerTable.isEditing()) {
TableCellEditor cellEditor = headerTable.getCellEditor(headerTable.getEditingRow(),
headerTable.getEditingColumn());
cellEditor.stopCellEditing();
}
tableModel.addNewRow();
tableModel.fireTableDataChanged();