Create implementation of NSAccessibilitySlider protocol 
https://developer.apple.com/documentation/appkit/nsaccessibilityslider

The implementation has the function performIncrement and performDecrement to 
increase/decrease the value of slider using the VoiceOver. To implement this 
functionality, I could think of  following two ways. I have chosen the first 
one here though it is more intrusive.
1. Make the AccessibleJSlider class implement the AccessibleAction interface. 
This makes AccessibleJSlider consistent with the AccessibleJSpinner class. It 
is more clear and the logic to increase/decrease Slider value can be changed 
easily. But this changes AccessibleJSlider class and will need a CSR.
2. Get the current Accessible Value from the component and  just 
increment/decrement it in SliderAccessibility.m  class itself and then set the 
current accessible value fro there only. This will not need any changes in 
AccessibleJSlider class, but this does not look correct way and I have not used 
this.

The changes can be easily tested by using a JSlider example, like the following 
example. VO should announce the correct the slider values. To change the slider 
values, use ctrl+opt+shift+down key to start interacting with the slider, then 
use ctrl+opt+up/down arrow keys to increment/decrement slider values.

      import javax.swing.JFrame;
      import javax.swing.JSlider;
      
      public class JSliderDemo{
          public static void main(String[] args) throws Exception {
              JFrame jframe = new JFrame("JSlider Demo");
              jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              jframe.add(new JSlider());
      
              jframe.setLocationRelativeTo(null);
              jframe.pack();
              jframe.setVisible(true);
          }
      }

-------------

Commit messages:
 - Remove whitespaces
 - remove SpinboxAccessibility.m changes
 - Code cleanup
 - cleanup
 - 8262981: Create implementation for NSAccessibilitySlider protocol

Changes: https://git.openjdk.java.net/jdk/pull/2874/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2874&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262981
  Stats: 74 lines in 4 files changed: 68 ins; 1 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2874.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2874/head:pull/2874

PR: https://git.openjdk.java.net/jdk/pull/2874

Reply via email to