Hi,

I am trying to make a cell in a JTable editable.
This table gets data from a MySQL table.

In the class that retrives data from the database I have added this method:

Java Code:
public boolean isCellEditable(int row, int col) {
if (col != 1) {
return false;
} else {
return true;
}
}
This makes the cell editable, but when I select another cell, the changes made in cell 1 is gone.
I would like to update the changes made into the database. What could be missing?

I have also made a actionlistener like this to get the new value in the cell, but when the changes disapeares when the focus on the cell is lost, no update gets to the database:

Java Code:
private void itemSaveActionPerformed(java.awt.event.ActionEvent evt) {                                         
        
int selectedRow = ledgerTable.getSelectedRow();
if (selectedRow != -1)
{
account         = Integer.parseInt(ledgerTable.getModel().getValueAt(selectedRow, 0).toString());
accountName = ledgerTable.getModel().getValueAt(selectedRow, 1).toString();
LedgerTable.Update(account, accountName);
}else{
JOptionPane.showMessageDialog(null, "Det er ikke valgt noe!", "Info", JOptionPane.INFORMATION_MESSAGE);
}
       
}
Any suggestions?