private static int getSortPriority ( JTable table , int column ) { List < ? extends SortKey > sortKeys = table . getRowSorter ( ) . getSortKeys ( ) ; for ( int i = 0 ; i < sortKeys . size ( ) ; i ++ ) { SortKey sortKey = sortKeys . get ( i ) ; if ( sortKey . getColumn ( ) == table . convertColumnIndexToModel ( column ) ) { return i ; } } return - 1 ; }
Returns the sort priority of the specified column in the given table where 0 means the highest priority and - 1 means that the column is not sorted .