# HG changeset patch # User rupashka # Date 1209476881 -14400 # Node ID 8ded0dbe4aaaaeb343f16a09857af74d98b7809c # Parent 11d2fe22f245c4ac2c6df4651f3bfce7e0dd6933 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 diff -r 11d2fe22f245 -r 8ded0dbe4aaa jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Tue Apr 29 15:47:17 2008 +0400 +++ b/jdk/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[] { diff -r 11d2fe22f245 -r 8ded0dbe4aaa jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Tue Apr 29 15:47:17 2008 +0400 +++ b/jdk/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, diff -r 11d2fe22f245 -r 8ded0dbe4aaa jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Tue Apr 29 15:47:17 2008 +0400 +++ b/jdk/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);