JComponent () { orphanModulesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); orphanModulesList.setItems(orphanModules, module -> FileUtilRt.getNameWithoutExtension(new File(module.getFirst()).getName())); //NON-NLS orphanModulesList.setBorder(JBUI.Borders.empty(5)); JScrollPane myModulesScrollPane = ScrollPaneFactory.createScrollPane(orphanModulesList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); myModulesScrollPane.setBorder(new MatteBorder(0, 0, 1, 0, JBColor.border())); myModulesScrollPane.setMaximumSize(new Dimension(-1, 300)); JPanel content = new JPanel(new BorderLayout()); content.add(myModulesScrollPane, BorderLayout.CENTER); return content; }