void (@NotNull PropertiesComponent propertyComponent, @NotNull String prefix, JTable table) { TableColumnModel columnModel = table.getTableHeader().getColumnModel(); int index = 0; List<String> columnIndices = new ArrayList<>(); while (true) { String order = propertyComponent.getValue(prefix + orderPropertyName(index)); if (order == null) { break; } columnIndices.add(order); index++; if (index == table.getColumnCount()) break; } index = 0; for (String columnIndex : columnIndices) { int modelColumnIndex = indexByModelIndex(columnModel, Integer.parseInt(columnIndex)); if (modelColumnIndex > 0 && modelColumnIndex < columnModel.getColumnCount()) { columnModel.moveColumn(modelColumnIndex, index); } index++; } for (int i = 0; i < columnIndices.size(); i++) { String width = propertyComponent.getValue(prefix + widthPropertyName(i)); if (width != null && width.length() > 0) { try { columnModel.getColumn(i).setPreferredWidth(Integer.parseInt(width)); } catch(NumberFormatException e) { LOG.error("Bad width: " + width + " at column: "+ i + " from: " + prefix + " actual columns count: " + columnModel.getColumnCount() + " info count: " + columnIndices.size(), e); } } } }