I have used a Jtable to store data fetching from database. But when i click Delete button to delete some particular row,the selected row get's deleted from database,but it is not refreshed in jtable. To get it reflected i have to again run the program.
What is your TableModel implementation you are using? Because you have to delete it from this one as well.
DefaultTableModel has a removeRow(int) method which can remove a row based on the number. For other implementations you have to check yourself. Keep in mind that some TableModels don't allow deletion and refreshing is the only way to go. Either that or change the model.
Originally posted by RaviSingh Kumar: But defaulttabelmodel is used with vector for data and column. And i am using two dimensional array.
If you are using two dimensional array you have to create new table and rearrange the data (copy all the data that you need after element at specified index is removed). After table is changed you should call
method, which will inform all the observers that data inside model have changed.
It would be easier for you to use Vector or ArrayList to store internal data of TableModel.