< prev index next >

src/demo/share/jfc/TableExample/TableSorter.java

Print this page

        

*** 89,99 **** super.setModel(model); reallocateIndexes(); } public int compareRowsByColumn(int row1, int row2, int column) { ! Class type = model.getColumnClass(column); TableModel data = model; // Check for nulls Object o1 = data.getValueAt(row1, column); --- 89,99 ---- super.setModel(model); reallocateIndexes(); } public int compareRowsByColumn(int row1, int row2, int column) { ! Class<?> type = model.getColumnClass(column); TableModel data = model; // Check for nulls Object o1 = data.getValueAt(row1, column);
*** 337,347 **** TableColumnModel columnModel = tableView.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableView.convertColumnIndexToModel(viewColumn); if (e.getClickCount() == 1 && column != -1) { System.out.println("Sorting ..."); ! int shiftPressed = e.getModifiers() & InputEvent.SHIFT_MASK; boolean ascending = (shiftPressed == 0); sorter.sortByColumn(column, ascending); } } }; --- 337,347 ---- TableColumnModel columnModel = tableView.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableView.convertColumnIndexToModel(viewColumn); if (e.getClickCount() == 1 && column != -1) { System.out.println("Sorting ..."); ! int shiftPressed = e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK; boolean ascending = (shiftPressed == 0); sorter.sortByColumn(column, ascending); } } };
< prev index next >