void (MouseWheelEvent event) { boolean isScrollEvent = isScrollEvent(event); boolean isScrollPaneEvent = event.getSource() instanceof JScrollPane; if (isScrollEvent && isScrollPaneEvent) { JScrollPane pane = (JScrollPane)event.getSource(); if (Boolean.TRUE.equals(ClientProperty.get(pane, FORCE_HORIZONTAL_SCROLL))) { event = withShiftModifier(event); } JScrollBar bar = event.isShiftDown() ? pane.getHorizontalScrollBar() : pane.getVerticalScrollBar(); boolean isWheelScrollEnabled = pane.isWheelScrollingEnabled(); boolean isBarVisible = bar != null && bar.isVisible(); boolean isAdjustedDeltaZero = bar instanceof JBScrollBar && ((JBScrollBar)bar).getDeltaAdjusted(event) == 0.0; if (isWheelScrollEnabled && isBarVisible && !isAdjustedDeltaZero) { if (TouchScrollUtil.isTouchScroll(event)) { if (myTouchScroll == null) { myTouchScroll = TouchScroll.create(); } myTouchScroll.processMouseWheelEvent(event, myDelegate::mouseWheelMoved); } else if (UISettings.getShadowInstance().getAnimatedScrolling()) { if (mySmoothScroll == null) { mySmoothScroll = MouseWheelSmoothScroll.create(() -> { return ScrollSettings.isEligibleFor(pane); }); } mySmoothScroll.processMouseWheelEvent(event, myDelegate::mouseWheelMoved); } else { if (LatchingScroll.isEnabled()) { if (myLatchingScroll == null) myLatchingScroll = new LatchingScroll(); if (myLatchingScroll.shouldBeIgnored(event)) { event.consume(); } } if (!event.isConsumed() && !(bar instanceof JBScrollBar && ((JBScrollBar)bar).handleMouseWheelEvent(event))) { myDelegate.mouseWheelMoved(event); } } } if (!event.isConsumed()) { // try to process a mouse wheel event by outer scroll pane MouseEventAdapter.redispatch(event, ComponentUtil .getParentOfType((Class<? extends JScrollPane>)JScrollPane.class, pane.getParent())); } } }