Here you can find the source of createColumnNames(TableModel model)
public static Object[][] createColumnNames(TableModel model)
//package com.java2s; //License from project: Open Source License import javax.swing.table.TableModel; public class Main { public static Object[][] createColumnNames(TableModel model) { Object rowValues[][] = new Object[2][0]; rowValues[0] = new Object[model.getColumnCount() != 0 ? model.getColumnCount() - 1 : 0]; rowValues[1] = new Object[model.getColumnCount() != 0 ? 1 : 0]; for (int a = 0; a < model.getColumnCount() - 1; a++) rowValues[0][a] = model.getColumnName(a); if (rowValues[1].length != 0) rowValues[1][0] = model.getColumnName(model.getColumnCount() - 1); return rowValues; }/*from w ww . j a va 2s .c om*/ }