code: @Override
      public boolean stopCellEditing() {
          JFormattedTextField ftf = (JFormattedTextField) getComponent();
          if (ftf.isEditValid()) {
              try {
                  ftf.commitEdit();
              } catch (java.text.ParseException ex) {
              }
  
          } else { //text is invalid
              Toolkit.getDefaultToolkit().beep();
              textField.selectAll();
              return false; //don't let the editor go away
          }
          return super.stopCellEditing();
      }
docs: of this method so that everything gets cleaned up.