changeset 6456:04d2005fa178

7132793: [macosx] setWheelScrollEnabled action reversed Reviewed-by: serb, art
author alexp
date Thu, 24 Jan 2013 15:52:25 +0400
parents dd7e1cc4253c
children 40a45a72a120
files src/macosx/classes/sun/lwawt/LWComponentPeer.java src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Jan 24 15:26:40 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Jan 24 15:52:25 2013 +0400
@@ -1226,7 +1226,7 @@
         sendEventToDelegate(e);
     }
 
-    private void sendEventToDelegate(final AWTEvent e) {
+    protected void sendEventToDelegate(final AWTEvent e) {
         synchronized (getDelegateLock()) {
             if (getDelegate() == null || !isShowing() || !isEnabled()) {
                 return;
--- a/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Thu Jan 24 15:26:40 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Thu Jan 24 15:52:25 2013 +0400
@@ -29,6 +29,7 @@
 import javax.swing.event.ChangeListener;
 import javax.swing.event.ChangeEvent;
 import java.awt.*;
+import java.awt.event.MouseWheelEvent;
 import java.awt.peer.ScrollPanePeer;
 import java.util.List;
 
@@ -52,6 +53,21 @@
     }
 
     @Override
+    public void handleEvent(AWTEvent e) {
+        if (e instanceof MouseWheelEvent) {
+            MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
+            //java.awt.ScrollPane consumes the event
+            // in case isWheelScrollingEnabled() is true,
+            // forcibly send the consumed event to the delegate
+            if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
+                sendEventToDelegate(wheelEvent);
+            }
+        } else {
+            super.handleEvent(e);
+        }
+    }
+
+    @Override
     public void stateChanged(final ChangeEvent e) {
         SwingUtilities.invokeLater(new Runnable() {
             @Override