aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Inserting, Editing, deleting rows in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Inserting, Editing, deleting rows in JTable" Watch "Inserting, Editing, deleting rows in JTable" New topic
Author

Inserting, Editing, deleting rows in JTable

sri rallapalli
Ranch Hand

Joined: Mar 15, 2005
Posts: 88
Hi All,

I am new to swings, and i am working on a swing application. I have developed some screens, in 1st screen i am showing the rows in the JTable, and i have 3 buttons Add,Edit,Delete.
For all the 3 actions(Add,Edit,Delete)
I will select a row in the Table, and then click the Button.

1. When i click the Add button, It will open another window with the existing values as default values, to take the new values and then if click ok, then it will be going to add a new Row to the table.

2. When i click edit button, It will open another window with the existing values as default values, to take the new values and then if click ok, then it will be going to change the Row that was selected and update to the table.

3. When i click the Delete button, it will delete the row, abd refresh the table.
In all the 3 operations, it will update the Database.
I am writing seperate classes for the 3 operations, and I am writing a seperate class for the Table to display its values.

Now the problem is, it is not refreshing the table contents when i do the operation, but when i close everything, and reopen freshly, i am able to see the content correctly. I want to see the Changes immediately after i do the operations.

Please help me. This is urgent.

Regards,
Srinivas.
Justin Chu
Ranch Hand

Joined: Apr 19, 2002
Posts: 209
    
    1
You have updated the database, but you'll also need to either recreate the table with new data, or update the table's model.
 
jQuery in Action, 2nd edition
 
subject: Inserting, Editing, deleting rows in JTable