Your example works (mostly) fine.
I assume you mean while the cell is editable it won't return the value which the editor is showing?
This makes sense, as the value contained by the editor hasn't yet been committed to the model.
What you can do is stop the current editing process if the table is in edit model, this will commit the value from the editor to the model, which you can then read...
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button) {
// Is the table in edit mode?
if (table.isEditing()) {
// Get the current editor
TableCellEditor editor = table.getCellEditor();
if (editor != null) {
// Try and stop the cell editing process
if (!editor.stopCellEditing()) {
// Cancel the editing if can't be stopped...
// You could handle an error state here instead...
editor.cancelCellEditing();
}
}
}
System.out.println(table.getValueAt(0, 0));
System.out.println(table.getValueAt(0, 1));
}
}
Of course, this all comes down to what it is you are trying to achieve...