JBScrollPane (@Nullable JComponent component) { JBScrollPane scrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) { @Override public Dimension getMinimumSize() { Dimension d = super.getMinimumSize(); JViewport viewport = getViewport(); if (viewport != null) { Component view = viewport.getView(); if (view instanceof Scrollable) { d.width = ((Scrollable)view).getPreferredScrollableViewportSize().width; } if (view != null) { d.width = view.getMinimumSize().width; } } d.height = Math.max(d.height, JBUIScale.scale(400)); return d; } }; scrollPane.setBorder(JBUI.Borders.empty()); scrollPane.setViewportBorder(JBUI.Borders.empty()); if (component != null) { scrollPane.getViewport().setView(component); } return scrollPane; }