Java tutorial
//package com.java2s; //License from project: Apache License import javax.swing.*; import javax.swing.table.TableColumnModel; public class Main { public static void setPreferredColumnWidths(final JTable table, final int... widths) { TableColumnModel columnModel = table.getColumnModel(); for (int col = 0; col < widths.length; col++) { columnModel.getColumn(col).setPreferredWidth(widths[col]); } } }