JComponent () { myEnabledDetectionCheckBox = new JCheckBox(ProjectBundle.message("checkbox.text.enable.framework.detection")); myEnabledDetectionCheckBox.setBorder(new EmptyBorder(10, 10, 0, 0)); final JBList<ExcludeListItem> excludesList = new JBList<>(myModel); final ColoredListCellRenderer<ExcludeListItem> renderer = new ColoredListCellRenderer<>() { final JPanel panel = new JPanel(new BorderLayout()); { panel.setBorder(JBUI.Borders.empty(2, 10, 2, 0)); panel.add(this); } @Override protected void customizeCellRenderer(@NotNull JList<? extends ExcludeListItem> list, ExcludeListItem value, int index, boolean selected, boolean hasFocus) { setIconTextGap(4); if (value != null) { value.renderItem(this); setBorder(JBUI.Borders.emptyLeft(10)); } } @Override public Component getListCellRendererComponent(JList<? extends ExcludeListItem> list, ExcludeListItem value, int index, boolean selected, boolean hasFocus) { super.getListCellRendererComponent(list, value, index, selected, hasFocus); panel.setBackground(UIUtil.getListBackground(selected, hasFocus)); return panel; } }; renderer.setMyBorder(JBUI.Borders.empty()); excludesList.setCellRenderer(renderer); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(excludesList) .setToolbarPosition(ActionToolbarPosition.TOP) .setPanelBorder(JBUI.Borders.empty()) .disableUpAction() .disableDownAction() .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { doAddAction(button); } }); myMainPanel = new JPanel(new BorderLayout(0, 5)); myMainPanel.add(myEnabledDetectionCheckBox, BorderLayout.NORTH); final LabeledComponent<JPanel> excludesComponent = LabeledComponent.create(decorator.createPanel(), ProjectBundle.message("label.exclude.from.detection")); myMainPanel.add(excludesComponent); myEnabledDetectionCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GuiUtils.enableChildren(myEnabledDetectionCheckBox.isSelected(), excludesComponent); } }); myEnabledDetectionCheckBox.setSelected(true); return myMainPanel; }