JComponent () { final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP)); myList = new JBList<>(myNamedElements); myList.setCellRenderer(new FQNameCellRenderer()); panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER); myExplanationLabel = new JBLabel(myContainsClassesOnly ? JavaBundle.message("dialog.paste.on.import.text") : JavaBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER); panel.add(myExplanationLabel, BorderLayout.NORTH); final JPanel buttonPanel = new JPanel(new VerticalFlowLayout()); final JButton okButton = new JButton(CommonBundle.getOkButtonText()); getRootPane().setDefaultButton(okButton); buttonPanel.add(okButton); final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText()); buttonPanel.add(cancelButton); panel.setPreferredSize(JBUI.size(500, 400)); return panel; }