can we update a row in JTable dynamically ?

Hi,

I have 40 rows in a JTable. assume i want to update 21st row, for this functionality i have written a right click popup, in which i have an option, 'Refresh Row', if we select this option, it fetches the data of the selected row, and makes a request for the latest data from the Database, now this latest data has to be inserted (replace the old data) at 21st row, i mean row which we selected to refresh.

Is it possible to update an individual row. If Yes, plz provide me some snippets or suggestions.

Regards,

Ravi Kumar

[559 byte] By [rkrgarlapatia] at [2007-11-27 3:44:04]
# 1
Well you could use the removeRow() and insertRow() methods of the DefaultTableModel.Or, you just update the existing row by using setValueAt(...) for each column.
camickra at 2007-7-12 8:47:42 > top of Java-index,Desktop,Core GUI APIs...
# 2
1. replace the data in your data model2. fire an event: ((AbstractTableModel)table.getModel()).fireTableRowsUpdated(firstRow, lastRow) ;thomas
kloebera at 2007-7-12 8:47:42 > top of Java-index,Desktop,Core GUI APIs...