6614972: JSlider value should not change on right-click

WindowsSliderUI won't use the right mouse button for change slider position

Reviewed-by: alexp
This commit is contained in:
Pavel Porvatov 2008-04-29 17:48:01 +04:00
parent f5ac15812c
commit f149163508
3 changed files with 12 additions and 1 deletions

View File

@ -982,7 +982,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
"LEFT", "positiveUnitIncrement",
"KP_LEFT", "positiveUnitIncrement",
}),
"Slider.onlyLeftMouseButtonDrag", Boolean.FALSE,
"Spinner.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {

View File

@ -1364,6 +1364,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
"LEFT", "positiveUnitIncrement",
"KP_LEFT", "positiveUnitIncrement",
}),
"Slider.onlyLeftMouseButtonDrag", Boolean.TRUE,
// *** Spinner
"Spinner.font", monospacedPlain12,

View File

@ -1573,6 +1573,11 @@ public class BasicSliderUI extends SliderUI{
// 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 @@ public class BasicSliderUI extends SliderUI{
isDragging = true;
return;
}
if (!SwingUtilities.isLeftMouseButton(e)) {
return;
}
isDragging = false;
slider.setValueIsAdjusting(true);