JRE-97 add ability to flip scrolling direction
diff --git a/src/windows/classes/sun/awt/windows/WComponentPeer.java b/src/windows/classes/sun/awt/windows/WComponentPeer.java
index 1008004..6a79ed4 100644
--- a/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -58,6 +58,9 @@
 import java.awt.dnd.peer.DropTargetPeer;
 import sun.awt.AWTAccessor;
 
+import sun.security.action.GetBooleanAction;
+import java.security.AccessController;
+
 import sun.util.logging.PlatformLogger;
 
 public abstract class WComponentPeer extends WObjectPeer
@@ -72,6 +75,23 @@
     private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.windows.shape.WComponentPeer");
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.windows.focus.WComponentPeer");
 
+    private static boolean flipHorizontalScrolling;
+    private static boolean flipVerticalScrolling;
+
+    private static native void setPlatformScrollingFlip(boolean horizontal, boolean vertical);
+
+    private static void setScrollingFlip(boolean horizontal, boolean vertical) {
+        setPlatformScrollingFlip(
+                flipHorizontalScrolling = horizontal,
+                flipVerticalScrolling = vertical);
+    }
+
+    static {
+        setScrollingFlip(
+                AccessController.doPrivileged(new GetBooleanAction("awt.flip.horizontal.scrolling")),
+                AccessController.doPrivileged(new GetBooleanAction("awt.flip.vertical.scrolling")));
+    }
+
     // ComponentPeer implementation
     SurfaceData surfaceData;
 
diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp
index 43cff97..678950f 100644
--- a/src/windows/native/sun/windows/awt_Component.cpp
+++ b/src/windows/native/sun/windows/awt_Component.cpp
@@ -210,6 +210,21 @@
 CriticalSection windowMoveLock;
 BOOL windowMoveLockHeld = FALSE;
 
+static BOOL flipHorizontalScrolling = FALSE;
+static BOOL flipVerticalScrolling = FALSE;
+
+/*
+ * Class:     sun_awt_windows_WComponentPeer
+ * Method:    setPlatformScrollingFlip
+ * Signature: (ZZ)V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_windows_WComponentPeer_setPlatformScrollingFlip
+  (JNIEnv* env, jclass c, jboolean horizontal, jboolean vertical)
+{
+    flipHorizontalScrolling = horizontal == JNI_TRUE;
+    flipVerticalScrolling = vertical == JNI_TRUE;
+}
+
 /************************************************************************
  * AwtComponent methods
  */
@@ -1704,12 +1719,16 @@
           case  WM_MOUSEWHEEL:
               mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam),
                                 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
-                                GET_WHEEL_DELTA_WPARAM(wParam));
+                                flipVerticalScrolling
+                                    ? -GET_WHEEL_DELTA_WPARAM(wParam)
+                                    : GET_WHEEL_DELTA_WPARAM(wParam));
               break;
           case  WM_MOUSEHWHEEL:
               mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam) | MK_SHIFT,
                                 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
-                                -GET_WHEEL_DELTA_WPARAM(wParam));
+                                flipHorizontalScrolling
+                                    ? -GET_WHEEL_DELTA_WPARAM(wParam)
+                                    : GET_WHEEL_DELTA_WPARAM(wParam));
               break;
           }
           break;