Question

I am writing a desktop application in Java and it uses two JTables as the main output.

I have a working version of the program where I use DefaultTableModels to manage the underlying data of the JTables and I use an ArrayList to store the data in each model.

However, I've come across the ResultSetTableModel which stores the data in a ResultSet and a ResultSetMetaData object to implement the TableModel methods.

But I am not clear on the benefits of using a ResultSetTableModel as opposed to a DefaultTableModel or AbstractTableModel. I have searched and I cannot find any discussion on this.

Does anyone know why one would favor a ResultSetTableModel over the other options?

Was it helpful?

Solution

if you use DefaultTableModel you have to store the data into model manually, and if you ResultSetTableModel data automatically loads into JTable this is the difference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top