How can i delete a row in table using abstractTableModel ?

Recommended Answers

All 2 Replies

AbstractTableModel is an abstract class, you can't create an instance of it, nor does it define methods for removing rows.
Maybe you are thinking of DefaultTableModel - which implements AbstractTableModel and has methods for adding & removing rows. See the API doc for details

I think that nothing complicated in this case

public class DefaultTableModel
extends AbstractTableModel
implements Serializable

you have to add and override this method for removeRow in your AbstractTableModel

public void removeRowAt(int row) {
    data.removeElementAt(row);
    //fireTableDataChanged();
    fireTableRowsDeleted(row - 1, data.size() - 1);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.