changeset 233:aaa771ded30b

6614972: JSlider value should not change on right-click Summary: WindowsSliderUI won't use the right mouse button for change slider position Reviewed-by: alexp
author rupashka
date Tue, 29 Apr 2008 17:48:01 +0400
parents 5b1734431fa5
children eca2e5716b86
files src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Apr 29 15:47:17 2008 +0400
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Apr 29 17:48:01 2008 +0400
@@ -982,7 +982,7 @@
                              "LEFT", "positiveUnitIncrement",
                           "KP_LEFT", "positiveUnitIncrement",
                          }),
-
+            "Slider.onlyLeftMouseButtonDrag", Boolean.FALSE,
 
             "Spinner.ancestorInputMap",
                new UIDefaults.LazyInputMap(new Object[] {
--- a/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Tue Apr 29 15:47:17 2008 +0400
+++ b/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Tue Apr 29 17:48:01 2008 +0400
@@ -1364,6 +1364,7 @@
                         "LEFT", "positiveUnitIncrement",
                      "KP_LEFT", "positiveUnitIncrement",
                  }),
+            "Slider.onlyLeftMouseButtonDrag", Boolean.TRUE,
 
             // *** Spinner
             "Spinner.font", monospacedPlain12,
--- a/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Tue Apr 29 15:47:17 2008 +0400
+++ b/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Tue Apr 29 17:48:01 2008 +0400
@@ -1573,6 +1573,11 @@
 
             // Clicked in the Thumb area?
             if (thumbRect.contains(currentMouseX, currentMouseY)) {
+                if (UIManager.getBoolean("Slider.onlyLeftMouseButtonDrag")
+                        && !SwingUtilities.isLeftMouseButton(e)) {
+                    return;
+                }
+
                 switch (slider.getOrientation()) {
                 case JSlider.VERTICAL:
                     offset = currentMouseY - thumbRect.y;
@@ -1584,6 +1589,11 @@
                 isDragging = true;
                 return;
             }
+
+            if (!SwingUtilities.isLeftMouseButton(e)) {
+                return;
+            }
+
             isDragging = false;
             slider.setValueIsAdjusting(true);