Change
public void setColumnName(int i, String name) {
columnNames[i,name];
}
to
public void setColumnName(int i, String name) {
columnNames[i] = name;
fireTableStructureChanged();
}
Following (always)good advices from @camickr
Invoking the fireTableStructureChanged() method will cause all custom renderers/editors to be lost. You can use the table.setAutoCreateColumnsFromModel(..) method when you create the table to prevent this from happening