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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top