JComponent (@Nls String title, List<? extends ContentFolderRef> folders, Color foregroundColor, @Nullable ModuleSourceRootEditHandler<?> editor) { final JPanel panel = new JPanel(new GridLayoutManager(folders.size(), 3, JBUI.insets(1, 17, 0, 5), 0, 1)); panel.setOpaque(false); for (int idx = 0; idx < folders.size(); idx++) { ContentFolderRef folderRef = folders.get(idx); final int verticalPolicy = idx == folders.size() - 1? GridConstraints.SIZEPOLICY_CAN_GROW : GridConstraints.SIZEPOLICY_FIXED; panel.add(createFolderComponent(folderRef, foregroundColor, editor), new GridConstraints(idx, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, verticalPolicy, null, null, null)); int column = 1; int colspan = 2; if (editor != null) { JComponent additionalComponent = createRootPropertiesEditor(editor, (SourceFolder)folderRef.getContentFolder()); if (additionalComponent != null) { panel.add(additionalComponent, new GridConstraints(idx, column++, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, verticalPolicy, null, null, null)); colspan = 1; } } panel.add(createFolderDeleteComponent(folderRef, editor), new GridConstraints(idx, column, 1, colspan, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, verticalPolicy, null, null, null)); } final JLabel titleLabel = new JLabel(title); final Font labelFont = StartupUiUtil.getLabelFont(); titleLabel.setFont(labelFont.deriveFont(Font.BOLD)); titleLabel.setOpaque(false); titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); registerTextComponent(titleLabel, foregroundColor); final JPanel groupPanel = new JPanel(new BorderLayout()); groupPanel.setOpaque(false); groupPanel.add(titleLabel, BorderLayout.NORTH); groupPanel.add(panel, BorderLayout.CENTER); return groupPanel; }