Here you can find the source of setTableColWidth(JTable table, int column, int width)
Parameter | Description |
---|---|
table | table. |
column | index of column. |
width | width value. |
public static TableColumn setTableColWidth(JTable table, int column, int width)
//package com.java2s; // the terms of the GNU General Public License as published by the Free Software Foundation; import javax.swing.*; import javax.swing.table.TableColumn; public class Main { /**// w ww . j a v a 2 s .co m * Sets the width of column to fixed value. * * @param table table. * @param column index of column. * @param width width value. * * @return column object. */ public static TableColumn setTableColWidth(JTable table, int column, int width) { TableColumn col = table.getColumnModel().getColumn(column); col.setMinWidth(width); col.setMaxWidth(width); return col; } }