Here you can find the source of cloneTableColumnModel(TableColumnModel m)
public static TableColumnModel cloneTableColumnModel(TableColumnModel m)
//package com.java2s; // modify it under the terms of the GNU General Public License import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; public class Main { public static TableColumnModel cloneTableColumnModel(TableColumnModel m) { DefaultTableColumnModel result = new DefaultTableColumnModel(); for (int i = 0; i < m.getColumnCount(); i++) result.addColumn(cloneTableColumn(m.getColumn(i))); return result; }/*from w ww. j a v a2 s . c om*/ public static TableColumn cloneTableColumn(TableColumn c) { TableColumn result = new TableColumn(c.getModelIndex(), c.getPreferredWidth(), c.getCellRenderer(), c.getCellEditor()); result.setMaxWidth(c.getMaxWidth()); result.setMinWidth(c.getMinWidth()); result.setResizable(c.getResizable()); result.setHeaderValue(c.getHeaderValue()); result.setHeaderRenderer(c.getHeaderRenderer()); result.setIdentifier(c.getIdentifier()); return result; } }