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:
parent
f5ac15812c
commit
f149163508
@ -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[] {
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user