private void initTableSorter(JTable table, AbstractTableModel model)
    {
        // NOTE 1: this code only works with JDK 1.6 or later
        // NOTE 2: since the data is stored as Strings, the data will be
        // in String order, not numeric order. This means "1000" < "200"
        // instead of 200 < 1000.
        // NOTE 3: TableRowSorter does not perform well with large tables.
        // A more robust approach would be to store the OMMMap data,
        // sort it by value, and then only display the top of the data
        // instead of letting TableRowSorter do the sorting.
        try
        {
            Class<?> aClass = Class.forName("javax.swing.table.TableRowSorter");
            Class<?>[] cArgs = { javax.swing.table.TableModel.class };
            Constructor<?> aCons = aClass.getConstructor(cArgs);
            Object[] oArr = { model };
            Object tableRowSorter = aCons.newInstance(oArr); // new
                                                             // TableRowSorter(_tableModel);

            Class<?> tableClass = javax.swing.JTable.class;
            Class<?> aClass2 = Class.forName("javax.swing.RowSorter");
            Class<?>[] cArgs2 = { aClass2 };
            Method m = tableClass.getMethod("setRowSorter", cArgs2);
            Object[] oArr2 = { tableRowSorter };
            m.invoke(table, oArr2); // _table.setRowSorter(tableRowSorter);

            Class<?> aClass3 = Class.forName("javax.swing.DefaultRowSorter");
            Class<?>[] cArgs3 = { Boolean.TYPE };
            m = aClass3.getMethod("setSortsOnUpdates", cArgs3);
            Object[] oArr3 = { Boolean.TRUE };
            m.invoke(tableRowSorter, oArr3);
        }
        catch (Exception e)
        {
            System.out.println("Sorter not available");
        }
    }