Here you can find the source of getColumnWidths(JTable p_Table)
public static int[] getColumnWidths(JTable p_Table)
//package com.java2s; //License from project: Open Source License import javax.swing.JTable; import javax.swing.table.TableColumnModel; public class Main { public static int[] getColumnWidths(JTable p_Table) { TableColumnModel model = p_Table.getTableHeader().getColumnModel(); int[] columnWidths = new int[model.getColumnCount()]; for (int i = 0, c = columnWidths.length; i < c; i++) { columnWidths[i] = model.getColumn(i).getWidth(); }//from w w w . j a v a2 s .c om return columnWidths; } }