Java examples for Swing:JTable Column
Recover a hidden JTable column
//package com.java2s; import javax.swing.JTable; import javax.swing.table.TableColumn; public class Main { public static void showColumn(JTable table, int columnIndex) { int currentResizeMode = table.getAutoResizeMode(); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); int columnCount = table.getColumnCount(); if (columnIndex < 0 || columnIndex > columnCount) throw new IllegalArgumentException( "TableUtils.hiddenColumn()"); TableColumn tc = table.getColumnModel().getColumn(columnIndex); tc.setMaxWidth(300);//from ww w . ja v a 2 s .c o m tc.setMinWidth(10); tc.setPreferredWidth(100); table.setAutoResizeMode(currentResizeMode); } }