I have a JFrame with a save button and cancel button, a jTable used to display data from my mysql database. I use a jDialog to insert record to the database and my jTable will display the records. However, what I want is this, If I click the cancel button in my JFrame, the recently added records in my database which is displayed in my JTable be deleted, since the cancel button is clicked which voids every addition or editing of the data in the database.
How can I cancel the saved records from the database if the cancel button is clicked. It is like restoring the jtable and its display to its original state when cancel button is pressed.
I'm having a hard time to explain my problem.. Please help.
I'm not sure if your question is about databases or JTables. I'm going to move it to our GUI forum where they know about JTables. (since JDBC is inundated with the promo this week) If it winds up being more about JDBC, someone can move it back.
Originally posted by Joshua Ebarvia: How can I cancel the saved records from the database if the cancel button is clicked. It is like restoring the jtable and its display to its original state when cancel button is pressed.
Either you clear the table and reload from the database (or I guess you could use a cache), or else you keep track of which rows the user added so they can be removed later.