sbool tableSetColumnPreferredWidths_debug; static void tableSetColumnPreferredWidths(final JTable table, final Map widths) { if (table == null || widths == null) ret; swing { pcall { TableColumnModel tcm = table.getColumnModel(); int n = tcm.getColumnCount(); for i to n: { TableColumn tc = tcm.getColumn(i); Int w = widths.get(str(tc.getHeaderValue()); if (w != null) { tc.setPreferredWidth(w); if (tableSetColumnPreferredWidths_debug) print("Setting preferred width of column " + i + " to " + w); } } }} } static void tableSetColumnPreferredWidths(JTable table, O... widths) { tableSetColumnPreferredWidths(table, litorderedmap(widths)); }