JComponent () { final JPanel panel = new JPanel(new GridBagLayout()); myDetectedRootsChooser = new DetectedRootsChooser(); myDetectedRootsChooser.addSelectionListener(() -> updateSelectedTypes()); final String text = JavaUiBundle.message("label.project.roots.have.been.found"); final JLabel label = new JLabel(text); label.setUI(new MultiLineLabelUI()); panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10, 0, 10), 0, 0)); panel.add(myDetectedRootsChooser.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBInsets.create(8, 10), 0, 0)); final JButton markAllButton = new JButton(JavaUiBundle.message("button.mark.all")); panel.add(markAllButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(0, 10, 8, 2), 0, 0)); final JButton unmarkAllButton = new JButton(JavaUiBundle.message("button.unmark.all")); panel.add(unmarkAllButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(0, 0, 8, 10), 0, 0)); markAllButton.addActionListener(e -> myDetectedRootsChooser.setAllElementsMarked(true)); unmarkAllButton.addActionListener(e -> myDetectedRootsChooser.setAllElementsMarked(false)); myResultPanel = new JPanel(new CardLayout()); myResultPanel.add(ROOTS_FOUND_CARD, panel); JPanel notFoundPanel = new JPanel(new BorderLayout()); notFoundPanel.setBorder(JBUI.Borders.empty(5)); notFoundPanel.add(BorderLayout.NORTH, new MultiLineLabel(JavaUiBundle.message("label.project.roots.not.found"))); myResultPanel.add(ROOTS_NOT_FOUND_CARD, notFoundPanel); return myResultPanel; }