void (List<? extends DetectedRootData> roots) { Set<String> rootTypes = new HashSet<>(); for (DetectedRootData root : roots) { for (DetectedProjectRoot projectRoot : root.getAllRoots()) { rootTypes.add(projectRoot.getRootTypeName()); } } myModel.setColumnInfos(new ColumnInfo[]{myIncludedColumn, ROOT_COLUMN, ROOT_TYPE_COLUMN}); int max = 0; for (String rootType : rootTypes) { max = Math.max(max, myTable.getFontMetrics(myTable.getFont()).stringWidth(rootType)); } final TableColumn column = myTable.getColumnModel().getColumn(2); int width = max + 20;//add space for combobox button column.setPreferredWidth(width); column.setMaxWidth(width); myTable.updateColumnSizes(); List<DetectedRootData> sortedRoots = new ArrayList<>(roots); sortedRoots.sort(Comparator.comparing(DetectedRootData::getDirectory)); myModel.setItems(sortedRoots); }