Here you can find the source of getColumnWidth(JTable table)
public static int[] getColumnWidth(JTable table)
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { public static int[] getColumnWidth(JTable table) { int[] columnWidth = new int[table.getColumnModel().getColumnCount()]; for (int i = 0; i < columnWidth.length; i++) { columnWidth[i] = table.getColumnModel().getColumn(i).getPreferredWidth(); }/* ww w . ja v a 2 s . co m*/ return columnWidth; } }