Here you can find the source of getSortOrder(@Nonnull RowSorter extends TableModel> rowSorter, int column)
Parameter | Description |
---|---|
rowSorter | the sorter |
column | the column index in the model, not the view |
@Nonnull public static SortOrder getSortOrder(@Nonnull RowSorter<? extends TableModel> rowSorter, int column)
//package com.java2s; //License from project: Open Source License import javax.annotation.Nonnull; import javax.swing.RowSorter; import javax.swing.RowSorter.SortKey; import javax.swing.SortOrder; import javax.swing.table.TableModel; public class Main { /**//from w w w. j ava 2s . c o m * Get the sort order for a column given a RowSorter for the TableModel * containing the column. * * @param rowSorter the sorter * @param column the column index in the model, not the view * @return the sort order or {@link javax.swing.SortOrder#UNSORTED}. */ @Nonnull public static SortOrder getSortOrder(@Nonnull RowSorter<? extends TableModel> rowSorter, int column) { for (SortKey key : rowSorter.getSortKeys()) { if (key.getColumn() == column) { return key.getSortOrder(); } } return SortOrder.UNSORTED; } }