Java examples for Swing:JTable Column
Hides a specific column of a JTable.
//package com.java2s; import javax.swing.table.TableColumn; public class Main { /**/* w w w . j a v a2 s . co m*/ * Hides a specific column of a JTable. * <p> * @param tc The table column. */ public static void hideJTableColumn(TableColumn tc) { lockJTableColumnWidth(tc, 0); } /** * Locks a Jtable's column width with 'pixels' size. * <p> * @param tc The table column. * @param pixels The desired pixels. */ public static void lockJTableColumnWidth(TableColumn tc, int pixels) { if (tc != null) { tc.setMinWidth(pixels); tc.setMaxWidth(pixels); tc.setPreferredWidth(pixels); tc.setResizable(false); } } }