Class ResultSetTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
com.mckoi.jfccontrols.ResultSetTableModel
All Implemented Interfaces:
Serializable, TableModel

public class ResultSetTableModel extends AbstractTableModel
An implementation of a javax.swing.table.TableModel that updates itself from a scrollable java.sql.ResultSet source. This directly maps columns from a query to columns in the table model. If you wish to filter information from the result set before it is output as a table use FilteredResultSetTableModel.
Author:
Tobias Downer
See Also:
  • Constructor Details

    • ResultSetTableModel

      public ResultSetTableModel(ResultSet result_set)
      Constructs the model.
    • ResultSetTableModel

      public ResultSetTableModel()
  • Method Details

    • setPreserveTableStructure

      public void setPreserveTableStructure(boolean status)
      A property that checks for changes when a result set is updated and preserves the layout if the updated result set looks similar. This means that the width of columns in the UI will not change to their default values.
    • updateResultSet

      public void updateResultSet(ResultSet result_set)
      Updates the result set in this model with the given ResultSet object.
    • clear

      public void clear()
      Clears the model of the current result set.
    • getRowCount

      public int getRowCount()
    • getColumnCount

      public int getColumnCount()
    • getColumnName

      public String getColumnName(int column)
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
    • getValueAt

      public Object getValueAt(int row, int column)