diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java index bc872f83..ab869fcb 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java @@ -2708,19 +2708,10 @@ debug*/ // because this listener receives mouse events for the whole tabbed pane, // we have to check whether the mouse is located over the viewport if( !isInViewport( e.getX(), e.getY() ) ) { - // if it is not in the viewport, retarget the even to a parent container + // if it is not in the viewport, retarget the event to a parent container // which might support scrolling (e.g. a surrounding ScrollPane) - Container parent = getParent(); - while (parent != null) { - // informing the first parent with a mouse wheel listener should be sufficient. - if (parent.getMouseWheelListeners().length > 0) { - for (MouseWheelListener parentListener : parent.getMouseWheelListeners()) { - parentListener.mouseWheelMoved(e); - } - return; - } - parent = parent.getContainer(); - } + Container parent = tabPane.getParent(); + parent.dispatchEvent( SwingUtilities.convertMouseEvent( tabPane, e, parent ) ); return; }