[ui] Use JBScrollPane for combo popups and set overlapping scroll bar

IJ-CR-115670

GitOrigin-RevId: 114f9aaa9b360ab2de84a6ffc1dbb7a2a80098d0
This commit is contained in:
Louis Vignier
2023-12-07 16:52:46 +00:00
committed by intellij-monorepo-bot
parent 97dfe7b080
commit 4dfb4685eb
@@ -9,6 +9,7 @@ import com.intellij.openapi.ui.popup.util.PopupUtil;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.dsl.listCellRenderer.KotlinUIDslRenderer;
import com.intellij.ui.popup.list.ComboBoxPopup;
import com.intellij.ui.render.RenderingUtil;
@@ -720,6 +721,16 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
super(combo);
}
@Override
protected JScrollPane createScroller() {
final var sp = new JBScrollPane(list,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
sp.setHorizontalScrollBar(null);
sp.setOverlappingScrollBar(true);
return sp;
}
@Override
protected void configurePopup() {
super.configurePopup();
@@ -786,8 +797,6 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
if (ExperimentalUI.isNewUI() && ComboBoxPopup.isRendererWithInsets(comboBox.getRenderer())) {
scroller.setViewportBorder(JBUI.Borders.empty(PopupUtil.getListInsets(false, false)));
scroller.setBackground(UIManager.getColor("ComboBox.background"));
scroller.getVerticalScrollBar().setBackground(UIManager.getColor("ComboBox.background"));
sideBorders = 10;
}