void (final int columnIndex, String sampleText) { final TableColumn column = myEntryTable.getTableHeader().getColumnModel().getColumn(columnIndex); final FontMetrics fontMetrics = myEntryTable.getFontMetrics(myEntryTable.getFont()); final int width = fontMetrics.stringWidth(" " + sampleText + " ") + JBUIScale.scale(4); column.setPreferredWidth(width); column.setMinWidth(width); column.setResizable(false); }