Java Swing: implement TableModel or extend AbstractTableModel?

AbstractTableModel has implementation for the handling of TableModelListeners including the firing of TableModelEvent s. If you want to handle that yourself, then there really is no reason to extend. Outside of that code, the other code doesn't add any benefit other than the stubbing out of methods declared in the interface.

AbstractTableModel has implementation for the handling of TableModelListeners, including the firing of TableModelEvents. If you want to handle that yourself, then there really is no reason to extend. Outside of that code, the other code doesn't add any benefit other than the stubbing out of methods declared in the interface.

When should I rather implement TableModel When you need a complete clean sheet implementation of the table model and/or you have to provide something that by the nature of your model doesn't exists yet or doesn't fit. And when should I extend AbstractTableModel? When you can reuse the existing structure and methods provided by the abstract class and/or it would easier for you to implement it.

The idea is, if you can re-use it, do so. If you can't, implement from scratch. By inheriting AbstractTableModel you'll be imlementing the TableModel interface anyway, it just will be easier.

AbstractTableModel provides default implementations for many of the methods defined in TableModel. If you don't need any custom behavior, then you can simply extend AbstractTableModel. Also, if your model already extends a different base class, then it would be appropriate just to implement TableModel.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions