Updating database from jtable

my table looks like When i edit the value in particular cell and without clicking anywhere if i click on Update button the database is not updated as like this !but if i click somewhere in the updating row, which again turns the look of table as fig.Don't forget to post your SSCCE in the new mahmoud saleh , I tried to run your code with some modification according to my database but it gives me Class Lang.exception on this line: I am trying to update database by editing cell values in jtable.

I am able to get values from the database and populate the Jtable. My requirement is that when the user edits one of the cell and moves away from that the changed value should be updated in the database.. In the Table Model class that you make, you need to add these methods Step 3: You will see in the second method that we fire a method called fire Table Cell Updated. You need to add a Table Model Listener to your table to catch this.So far so good, I get the table: Standard you can click a table cell and it changes to a text-field with can be filled with something new.You all know that, but how can I use this to also update the value in my database?Maybe your update button is updating the database, but there's no code to update the JTable at that point, so you don't see that it's updated?Then when you do anything that causes a repaint of the JTable you see the new data?

Leave a Reply