int (int columnToExpand) { int expandedWidth = getPreferredHeaderWidth(columnToExpand); for (int row = 0; row < getRowCount(); row++) { TableCellRenderer cellRenderer = getCellRenderer(row, columnToExpand); if (cellRenderer != null) { Component c = prepareRenderer(cellRenderer, row, columnToExpand); expandedWidth = Math.max(expandedWidth, c.getPreferredSize().width); } } return expandedWidth; }