mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
TabbedPane:
- convert mouse wheel event before dispatching it to parent - use `Component.dispatchEvent()`, instead of invoking mouse wheel listeners directly, which dispatches the event to an ancestor
This commit is contained in:
@@ -2708,19 +2708,10 @@ debug*/
|
|||||||
// because this listener receives mouse events for the whole tabbed pane,
|
// because this listener receives mouse events for the whole tabbed pane,
|
||||||
// we have to check whether the mouse is located over the viewport
|
// we have to check whether the mouse is located over the viewport
|
||||||
if( !isInViewport( e.getX(), e.getY() ) ) {
|
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)
|
// which might support scrolling (e.g. a surrounding ScrollPane)
|
||||||
Container parent = getParent();
|
Container parent = tabPane.getParent();
|
||||||
while (parent != null) {
|
parent.dispatchEvent( SwingUtilities.convertMouseEvent( tabPane, e, parent ) );
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user