NumberEditorExt extends DefaultCellEditor { @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { ((JComponent)getComponent()).setBorder(new LineBorder(Color.black)); try { final Class<?> type = table.getColumnClass(column); if (hasStrictFormatter()) { ((NumberFormatter) getComponent().getFormatter()).setValueClass(type); } else { if (!Number.class.isAssignableFrom(type)) { throw new IllegalStateException("NumberEditor can only handle subclasses of java.lang.Number"); } constructor = type.getConstructor(argTypes); } return super.getTableCellEditorComponent(table, value, isSelected, row, column); } catch (Exception ex) { throw new IllegalStateException("value/type not compatible with Number", ex); } } NumberEditorExt();  NumberEditorExt(NumberFormat format);  NumberEditorExt(boolean useStrictFormatter);  NumberEditorExt(NumberFormat format, boolean useStrictFormatter); @Override boolean stopCellEditing(); @Override Component getTableCellEditorComponent(JTable table, Object value,
                                             boolean isSelected,
                                             int row, int column); @Override Number getCellEditorValue(); @Override JFormattedTextField getComponent();  }
@Test public void testEditorStrictObjectColumn() { cellEditorStrict.getTableCellEditorComponent(table, null, false, 0, OBJECT_COLUMN); }
@Test (expected = IllegalStateException.class) public void testEditorObjectColumn() { cellEditor.getTableCellEditorComponent(table, null, false, 0, OBJECT_COLUMN); }