TableRowSorter without column class : JTable Sort « Swing « Java Tutorial

TableRowSorter without column class
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.RowSorter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

public class TableRowSorterWithoutColumnClass extends JFrame {
  public TableRowSorterWithoutColumnClass() {

    String[] columns = { "Item", "Price" };

    Object[][] rows = { { "P", 10.98 }, { "Magazine", 7.99 },
        { "Can of soup", 0.89 }, { "DVD movie", 39.99 } };

    TableModel model = new DefaultTableModel(rows, columns);
    JTable table = new JTable(model);
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    getContentPane().add(new JScrollPane(table));

    setSize(200, 150);

  public static void main(String[] args) {

    new TableRowSorterWithoutColumnClass();


14.63.JTable Sort
14.63.1.JTable Sorting in JDK6
14.63.2.Using RowSorter to sort a JTable
14.63.3.TableRowSorter with column classTableRowSorter with column class
14.63.4.TableRowSorter without column classTableRowSorter without column class
14.63.5.Sorting the Rows in a JTable Component Based on a Column
14.63.6.Sorting a Column in a JTable Component
14.63.7.Sorting and Filtering Tables
14.63.8.Sorting JTable Elements
14.63.9.A simple extension of JTable that supports the use of a SortableTableModel.