void (@NotNull Collection<JComponent> rowComponents) { JPanel row = new MultiRowFlowPanel(FlowLayout.CENTER, 0, 3); row.setBackground(myBackgroundColor); myComponents.add(row); if (rowComponents.isEmpty()) { row.add(new JLabel(" ")); } else { for (JComponent component : rowComponents) { row.add(component); } } GridBagConstraints constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.weightx = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.insets.top = 3; myResult.add(row, constraints); }