Here you can find the source of getTotalColumnWidth(JTable table)
public static int getTotalColumnWidth(JTable table)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.Enumeration; import javax.swing.JTable; import javax.swing.table.TableColumn; public class Main { /**/*from w w w .ja va 2s.c o m*/ * Find out the table width to be used * * @table JTable object */ public static int getTotalColumnWidth(JTable table) { Enumeration<TableColumn> en = table.getColumnModel().getColumns(); int width = 0; while (en.hasMoreElements()) { TableColumn col = en.nextElement(); width += col.getWidth(); } return width - 200; } }