Here you can find the source of createDefaultTableModel(String[] columnNames)
public static DefaultTableModel createDefaultTableModel(String[] columnNames)
//package com.java2s; //License from project: Open Source License import javax.swing.table.DefaultTableModel; public class Main { public static DefaultTableModel createDefaultTableModel(String[] columnNames) { return new DefaultTableModel(new Object[][] {}, columnNames) { @Override//from w w w . j a v a 2s . c o m public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 1: return Boolean.class; default: return String.class; } } @Override public boolean isCellEditable(int row, int column) { switch (column) { case 1: return true; default: return false; } } }; } }