List of usage examples for javax.swing.table TableColumnModel removeColumn
public void removeColumn(TableColumn column);
TableColumn
column
from the tableColumns
array. From source file:org.pentaho.reporting.ui.datasources.table.TableEditor.java
/** * Creates default columns for the table from the data model using the <code>getColumnCount</code> method defined in * the <code>TableModel</code> interface. * <p/>/*from w ww .jav a 2 s . c o m*/ * Clears any existing columns before creating the new columns based on information from the model. * * @see #getAutoCreateColumnsFromModel */ public void createDefaultColumnsFromModel() { final TableModel m = getModel(); if (m != null) { // Remove any current columns final TableColumnModel cm = getColumnModel(); while (cm.getColumnCount() > 0) { cm.removeColumn(cm.getColumn(0)); } // Create new columns from the data model info for (int i = 0; i < m.getColumnCount(); i++) { if (i == 0) { final TableColumn column = new TableColumn(i); column.setCellRenderer(tableHeader.getDefaultRenderer()); addColumn(column); continue; } final EditableHeaderTableColumn newColumn = new EditableHeaderTableColumn(i); newColumn.setHeaderEditor(new TypedHeaderCellEditor()); addColumn(newColumn); } } }