@Override
public void focusLost(FocusEvent e) {
final int editingRow = table.getEditingRow();
final int editingColumn = table.getEditingColumn();
CellEditor ce = null;
if (editingRow != -1 && editingColumn != -1){
ce = table.getCellEditor(editingRow,editingColumn);
}
Component editor = table.getEditorComponent();
if(ce != null && (editor == null || editor != e.getOppositeComponent()))
{
ce.stopCellEditing();
}
else if(editor != null)
{
editor.addFocusListener(this);
}