Here you can find the source of setColumnMaxWidths(JTable tbl, Integer... widths)
public static void setColumnMaxWidths(JTable tbl, Integer... widths)
//package com.java2s; //License from project: Apache License import javax.swing.JTable; import javax.swing.table.TableColumnModel; public class Main { public static void setColumnMaxWidths(JTable tbl, Integer... widths) { TableColumnModel columnModel = tbl.getColumnModel(); for (int i = 0; i < widths.length; i++) { if (widths[i] > -1) { columnModel.getColumn(i).setMaxWidth(widths[i]); }//from w w w . j a va 2 s . co m } } }