JComponent () { final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP)); myList = new JBList(myNamedElements); myList.setCellRenderer(new KotlinImportListRenderer()); panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER); panel.add(new JBLabel(myContainsClassesOnly ? JavaBundle.message("dialog.paste.on.import.text") : JavaBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), 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(new Dimension(500, 400)); return panel; }