JLabel (@NotNull EditorEx editor, Color background, ExtendableTextComponent.Extension extension) { JLabel label = ExpandableSupport.createLabel(extension); label.setBorder(JBUI.Borders.emptyLeft(2)); editor.getScrollPane().setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); editor.getScrollPane().setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); JScrollBar scrollBar = editor.getScrollPane().getVerticalScrollBar(); JPanel panel = ClientProperty.get(scrollBar, BUTTON_CONTAINER); if (panel == null) { panel = new JPanel(new HorizontalLayout(4)); panel.setOpaque(false); ClientProperty.put(scrollBar, BUTTON_CONTAINER, panel); scrollBar.setBackground(background); scrollBar.add(JBScrollBar.LEADING, panel); scrollBar.setOpaque(true); } panel.add(label); return label; }