Reputation: 134
I'm trying to edit the selected column in the selected row with button click like this
contactTable.getModel().setValueAt(
contactTable.getValueAt(contactTable.getSelectedRow(),
contactTable.getSelectedColumn()),
contactTable.getSelectedRow(),
contactTable.getSelectedColumn()
);
but before saving button click if I don't click in another column edit doesn't work, so what is the reason? and how can I fix it?
Upvotes: 0
Views: 99
Reputation: 324197
The edited value is still in the cell editor, not in the TableModel. The value is automatically saved if you move to another cell in the table.
However, if you click on a button you must manually save the data. This can be done in one of two ways:
Check out Table Stop Editing for more information and examples of these two approaches.
Upvotes: 1