Source:
protected void setColumnWidths() { if (rootNode.getChildren().getNodesCount() != 0) { final Graphics graphics = outlineView.getGraphics(); if (graphics != null) { double outlineViewWidth = outlineView.getSize().getWidth(); List<Integer> columnWidths = new ArrayList<>(); final FontMetrics metrics = graphics.getFontMetrics(); int margin = 4; int padding = 8; int totalColumnWidth = 0; int cntMaxSizeColumns =0; for (int column = 0; column < outline.getModel().getColumnCount(); column++) { int firstColumnPadding = (column == 0) ? 32 : 0; int columnWidthLimit = (column == 0) ? 350 : 300; int valuesWidth = 0; for (int row = 0; row < Math.min(100, outline.getRowCount()); row++) { TableCellRenderer renderer = outline.getCellRenderer(row, column); Component comp = outline.prepareRenderer(renderer, row, column); valuesWidth = Math.max(comp.getPreferredSize().width, valuesWidth); } int headerWidth = metrics.stringWidth(outline.getColumnName(column)); valuesWidth += firstColumnPadding; int columnWidth = Math.max(valuesWidth, headerWidth); columnWidth += 2 * margin + padding; columnWidth = Math.min(columnWidth, columnWidthLimit); columnWidths.add(columnWidth); totalColumnWidth += columnWidth; if( columnWidth == columnWidthLimit) { cntMaxSizeColumns++; } } int extraWidth = 0; if (totalColumnWidth < outlineViewWidth) { if (cntMaxSizeColumns > 0) { extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/cntMaxSizeColumns); } else { extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/columnWidths.size()); } } for(int column = 0; column < columnWidths.size(); column++) { int columnWidth = columnWidths.get(column); if(cntMaxSizeColumns > 0) { if(columnWidth >= 300) { columnWidth += extraWidth; } } else { columnWidth += extraWidth; } outline.getColumnModel().getColumn(column).setPreferredWidth(columnWidth); } } } else { outline.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); } }

Target:
protected void setColumnWidths() { if (rootNode.getChildren().getNodesCount() != 0) { final Graphics graphics = outlineView.getGraphics(); if (graphics != null) { double outlineViewWidth = outlineView.getSize().getWidth(); List<Integer> columnWidths = new ArrayList<>(); final FontMetrics metrics = graphics.getFontMetrics(); int margin = 4; int padding = 8; int totalColumnWidth = 0; int cntMaxSizeColumns =0; for (int column = 0; column < outline.getModel().getColumnCount(); column++) { int firstColumnPadding = (column == 0) ? 32 : 0; int columnWidthLimit = (column == 0) ? 350 : 300; int valuesWidth = 0; for (int row = 0; row < Math.min(100, outline.getRowCount()); row++) { TableCellRenderer renderer = outline.getCellRenderer(row, column); Component comp = outline.prepareRenderer(renderer, row, column); valuesWidth = Math.max(comp.getPreferredSize().width, valuesWidth); } int headerWidth = metrics.stringWidth(outline.getColumnName(column)); valuesWidth += firstColumnPadding; int columnWidth = Math.max(valuesWidth, headerWidth); columnWidth += 2 * margin + padding; columnWidth = Math.min(columnWidth, columnWidthLimit); columnWidths.add(columnWidth); totalColumnWidth += columnWidth; if( columnWidth == columnWidthLimit) { cntMaxSizeColumns++; } } int extraWidth = 0; if (totalColumnWidth < outlineViewWidth) { if (cntMaxSizeColumns > 0) { extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/cntMaxSizeColumns); } else { extraWidth = (int) ((outlineViewWidth - totalColumnWidth)/columnWidths.size()); } } for(int column = 0; column < columnWidths.size(); column++) { int columnWidth = columnWidths.get(column); if(cntMaxSizeColumns > 0) { if(columnWidth >= ((column == 0) ? 350 : 300)) { columnWidth += extraWidth; } } else { columnWidth += extraWidth; } outline.getColumnModel().getColumn(column).setPreferredWidth(columnWidth); } } } else { outline.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); } }