Class SortedTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class SortedTable extends JTable
The SortedTable class is a normal javax.swing.JTable that can sort its rows when the user clicks on a column in the table header.
Since:
3.2.1
Author:
Peter Hollemans
See Also:
  • Constructor Details

    • SortedTable

      public SortedTable(TableModel model)
      Creates a new table from the specified model.
      Parameters:
      model - the model to use for table data.
  • Method Details

    • convertRowIndexToModel

      public int convertRowIndexToModel(int row)
      Converts a row index in the sorted model to a row index in the underlying model.
      Overrides:
      convertRowIndexToModel in class JTable
      Parameters:
      row - the row index to convert.
      Returns:
      the row index in the underlying table model.
    • convertRowIndexToView

      public int convertRowIndexToView(int row)
      Converts a row index in the underlying model to a row index in the sorted model.
      Overrides:
      convertRowIndexToView in class JTable
      Parameters:
      row - the row index to convert.
      Returns:
      the row index in the sorted table model.
    • main

      public static void main(String[] argv)
      Tests this class.
      Parameters:
      argv - the array of command line parameters.