Here you can find the source of getColumns(TableColumnModel columnModel)
public static List<TableColumn> getColumns(TableColumnModel columnModel)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; public class Main { public static List<TableColumn> getColumns(TableColumnModel columnModel) { List<TableColumn> tablecolumns = new ArrayList<TableColumn>( columnModel.getColumnCount()); for (int columnIndex = 0; columnIndex < columnModel .getColumnCount(); columnIndex++) { tablecolumns.add(columnModel.getColumn(columnIndex)); }//from w w w . j av a2 s. c om return tablecolumns; } }