I would like to remove selected row from JTable with AbstractTableModel using a button.
The code below works with DefaultTableModel:
<
DefaultTableModel will itself call fireXX methods whenever there is a change in the table model. But if we use AbstractTableModel then we have to explicitly call fireXX methods. So when ever there is a change in the table just call relevant fireXX method.
For,
inserting a new row to the table use fireTableRowsInserted
deletion (in your case) use fireTableRowsDeleted
update use fireTableRowsUpdated
NOTE: DefaultTableModel has most of all the methods implemented. So unless there is a real need go for AbstractTableModel else stick with DefaultTableModel.