src/main/java/org/jwellman/swing/jtable/TableColumnManager.java
private void showColumn(TableColumn column) {
        // Ignore changes to the TableColumnModel made during this method
        tableColumnModel.removeColumnModelListener(this);

        // Add the column to the end of the table

        tableColumnModel.addColumn(column);

        // Move the column to its position before it was hidden.
        // (Multiple columns may be hidden so we need to find the first
        // visible column before this column so the column can be moved
        // to the appropriate position)

        int to = 0;
        final int from = tableColumnModel.getColumnCount() - 1;        
        final int position = allColumns.indexOf(column);
        for (int i = position - 1; i > -1; i--) {
            try {
                final TableColumn visibleColumn = allColumns.get(i);
                to = tableColumnModel.getColumnIndex(visibleColumn.getHeaderValue()) + 1;
                break;
            } catch (IllegalArgumentException e) {
            }
        }

        tableColumnModel.moveColumn(from, to);

        // Restore this as a listener now that we are done
        tableColumnModel.addColumnModelListener(this);
    }
/**
     * Show a hidden column in the table. 
     * The column will be positioned at its proper place in the view of the table.
     *
     * @param column
     *            the TableColumn to be shown.
     */
Show a hidden column in the table.
The column will be positioned at its proper place in the view of the table.

@param column
the TableColumn to be shown.
Show a hidden column in the table . The column will be positioned at its proper place in the view of the table . @param column the TableColumn to be shown .
private void showColumn(TableColumn column) {
        tableColumnModel.removeColumnModelListener(this);
        tableColumnModel.addColumn(column);
        int to = 0;
        final int from = tableColumnModel.getColumnCount() - 1;        
        final int position = allColumns.indexOf(column);
        for (int i = position - 1; i > -1; i--) {
            try {
                final TableColumn visibleColumn = allColumns.get(i);
                to = tableColumnModel.getColumnIndex(visibleColumn.getHeaderValue()) + 1;
                break;
            } catch (IllegalArgumentException e) {
            }
        }
        tableColumnModel.moveColumn(from, to);
        tableColumnModel.addColumnModelListener(this);
    }
private void showColumn ( TableColumn column ) { tableColumnModel . removeColumnModelListener ( this ) ; tableColumnModel . addColumn ( column ) ; int to = 0 ; final int from = tableColumnModel . getColumnCount ( ) - 1 ; final int position = allColumns . indexOf ( column ) ; for ( int i = position - 1 ; i > - 1 ; i -- ) { try { final TableColumn visibleColumn = allColumns . get ( i ) ; to = tableColumnModel . getColumnIndex ( visibleColumn . getHeaderValue ( ) ) + 1 ; break ; } catch ( IllegalArgumentException e ) { } } tableColumnModel . moveColumn ( from , to ) ; tableColumnModel . addColumnModelListener ( this ) ; }
Show a hidden column in the table.
Show a hidden column in the table .
// Ignore changes to the TableColumnModel made during this method // Add the column to the end of the table // Move the column to its position before it was hidden. // (Multiple columns may be hidden so we need to find the first // visible column before this column so the column can be moved // to the appropriate position) // Restore this as a listener now that we are done