Java JTable Header setPressedColumn(JTableHeader tableHeader, int columnModelIndex)

Here you can find the source of setPressedColumn(JTableHeader tableHeader, int columnModelIndex)

Description

Sets the given column for the given JTableHeader as pressed.

License

Open Source License

Parameter

Parameter Description
tableHeader the JTableHeader to set the pressed state for.
columnModelIndex the column model index of the pressed column.

Declaration

public static void setPressedColumn(JTableHeader tableHeader, int columnModelIndex) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.table.JTableHeader;

public class Main {
    private static final String PRESSED_COLUMN_KEY = "EPJTableHeader.pressedColumn";

    /**/*from www.j  av a  2s  . com*/
     * Sets the given column for the given {@link JTableHeader} as pressed. Calling this method
     * installs a hint, which can be used by renders to draw the correct column pressed state.
     * Renders can use {@link #isColumnPressed(javax.swing.table.JTableHeader, int)} to determine
     * what state to draw the header for the given index in.
     * header state.
     *
     * @param tableHeader      the {@code JTableHeader} to set the pressed state for.
     * @param columnModelIndex the column model index of the pressed column.
     */
    public static void setPressedColumn(JTableHeader tableHeader, int columnModelIndex) {
        tableHeader.putClientProperty(PRESSED_COLUMN_KEY, columnModelIndex);
    }
}

Related

  1. modifyTableHeader(JTableHeader head, Vector columnNames)
  2. paintHeader(Graphics graphics, JTable table, int x, int width)
  3. removeBadChars(JTable table, boolean skipHeaderBoolean)
  4. setHeaderIcon(JTable table, final int column, final ImageIcon icon)
  5. setOptimalHeaderWidth(int col)
  6. setTableHeaderCellRenderer(TableColumn tableCol)
  7. setupAsRowHeader(final JTable table)
  8. sizeColumnsToFit(JTable table, boolean useHeader, boolean useContent)
  9. tableHeaders(JTable jtable)