JComponent () { final JPanel panel = new JPanel(new BorderLayout()); final DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.add(new FilterExistentAction()); ActionToolbar chooser = ActionManager.getInstance().createActionToolbar("DirectoryChooser", actionGroup, true); chooser.setTargetComponent(myView.getComponent()); JComponent chooserComponent = chooser.getComponent(); chooserComponent.setBorder(JBUI.Borders.empty(6, 0)); panel.add(chooserComponent, BorderLayout.NORTH); final Runnable runnable = () -> enableButtons(); myView.onSelectionChange(runnable); final JComponent component = myView.getComponent(); final JScrollPane jScrollPane = ScrollPaneFactory.createScrollPane(component); int prototypeWidth = component.getFontMetrics(component.getFont()).stringWidth("X:\\1234567890\\1234567890\\com\\company\\system\\subsystem"); jScrollPane.setPreferredSize(new Dimension(Math.max(300, prototypeWidth),300)); jScrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL); installEnterAction(component); panel.add(jScrollPane, BorderLayout.CENTER); myTabbedPaneWrapper.addTab(LangBundle.message("tab.title.directory.structure"), panel); if (myByClassPanel != null) { myTabbedPaneWrapper.addTab(LangBundle.message("tab.title.by.class"), myByClassPanel.getPanel()); } myTabbedPaneWrapper.addTab(LangBundle.message("tab.title.by.file"), myByFilePanel.getPanel()); myTabbedPaneWrapper.addChangeListener(e -> enableButtons()); return myTabbedPaneWrapper.getComponent(); }