Here you can find the source of getSelectedColumn(JTableHeader tableHeader)
Parameter | Description |
---|---|
tableHeader | the JTableHeader to determine the selected column header for. |
public static int getSelectedColumn(JTableHeader tableHeader)
//package com.java2s; //License from project: Open Source License import javax.swing.table.JTableHeader; public class Main { public static final int NO_COLUMN = -1; private static final String SELECTED_COLUMN_KEY = "EPJTableHeader.selectedColumn"; /**//from w ww. ja v a 2 s. co m * Get's the selected column header for the given {@link JTableHeader}. * * @param tableHeader the {@code JTableHeader} to determine the selected column header for. * @return the column model index of the selected column header, or {@link #NO_COLUMN} if no * column's header has been pressed. * @see #isColumnSelected(javax.swing.table.JTableHeader, int) */ public static int getSelectedColumn(JTableHeader tableHeader) { Object selectedColumnValue = tableHeader.getClientProperty(SELECTED_COLUMN_KEY); return selectedColumnValue != null && selectedColumnValue instanceof Integer ? ((Integer) selectedColumnValue) : NO_COLUMN; } }