title: Lose Focus and Commit Edit on a JSpinner when clicking outside the spinner
body: <p>I have a JTable, whose cell editors are JSpinners. I'm using a custom cell editor class to accomplish this.  I have a few other components in my JPanel. My problem arises when the user is editing one of the cells (i.e. a JSpinner has focus) and then interacts with one of the other components without first pressing enter or losing focus.  I want the JSpinner to immediately lose focus and commit the changes before running the code associated with the other components, but instead the JSpinner just retains its focus. </p>
  
  <p>Ideally, I would like the JSpinner to lose focus immediately whenever the user clicks anywhere but inside the JSpinner itself. Here's my custom editor class:</p>
  
  <pre><code>public class PhyMappingTableCellEditor extends AbstractCellEditor implements TableCellEditor {
      final JSpinner spinner = new JSpinner();
  
      public PhyMappingTableCellEditor(ArrayList&lt;String&gt; phys) {
          spinner.setModel(new SpinnerListModel(phys));
          spinner.setBorder(new EmptyBorder(0,0,0,0)); 
      }
  
      @Override
      public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
          int row, int column) {
          spinner.setValue(value);
          return spinner;
      }
  
      @Override
      public Object getCellEditorValue() {
          return spinner.getValue();
      }
  }
  </code></pre>
  
  <p>Thanks in advance!</p>