Java examples for Swing:JTable Column
get Sort Key from JTable by Column
//package com.java2s; import java.util.List; import javax.swing.JTable; import javax.swing.RowSorter; import javax.swing.RowSorter.SortKey; public class Main { public static SortKey getSortKey(JTable table, int column) { RowSorter rowSorter = table.getRowSorter(); if (rowSorter == null) { return null; }/*from ww w .j av a 2s . c o m*/ List sortedColumns = rowSorter.getSortKeys(); if (!sortedColumns.isEmpty()) { return (SortKey) sortedColumns.get(0); } return null; } }