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",
|
"LEFT", "positiveUnitIncrement",
|
||||||
"KP_LEFT", "positiveUnitIncrement",
|
"KP_LEFT", "positiveUnitIncrement",
|
||||||
}),
|
}),
|
||||||
|
"Slider.onlyLeftMouseButtonDrag", Boolean.FALSE,
|
||||||
|
|
||||||
"Spinner.ancestorInputMap",
|
"Spinner.ancestorInputMap",
|
||||||
new UIDefaults.LazyInputMap(new Object[] {
|
new UIDefaults.LazyInputMap(new Object[] {
|
||||||
|
@ -1364,6 +1364,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
|
|||||||
"LEFT", "positiveUnitIncrement",
|
"LEFT", "positiveUnitIncrement",
|
||||||
"KP_LEFT", "positiveUnitIncrement",
|
"KP_LEFT", "positiveUnitIncrement",
|
||||||
}),
|
}),
|
||||||
|
"Slider.onlyLeftMouseButtonDrag", Boolean.TRUE,
|
||||||
|
|
||||||
// *** Spinner
|
// *** Spinner
|
||||||
"Spinner.font", monospacedPlain12,
|
"Spinner.font", monospacedPlain12,
|
||||||
|
@ -1573,6 +1573,11 @@ public class BasicSliderUI extends SliderUI{
|
|||||||
|
|
||||||
// Clicked in the Thumb area?
|
// Clicked in the Thumb area?
|
||||||
if (thumbRect.contains(currentMouseX, currentMouseY)) {
|
if (thumbRect.contains(currentMouseX, currentMouseY)) {
|
||||||
|
if (UIManager.getBoolean("Slider.onlyLeftMouseButtonDrag")
|
||||||
|
&& !SwingUtilities.isLeftMouseButton(e)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (slider.getOrientation()) {
|
switch (slider.getOrientation()) {
|
||||||
case JSlider.VERTICAL:
|
case JSlider.VERTICAL:
|
||||||
offset = currentMouseY - thumbRect.y;
|
offset = currentMouseY - thumbRect.y;
|
||||||
@ -1584,6 +1589,11 @@ public class BasicSliderUI extends SliderUI{
|
|||||||
isDragging = true;
|
isDragging = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!SwingUtilities.isLeftMouseButton(e)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isDragging = false;
|
isDragging = false;
|
||||||
slider.setValueIsAdjusting(true);
|
slider.setValueIsAdjusting(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user