On Wed, 23 Feb 2022 04:24:41 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
> It is observed that mouseWheel doesn't scroll through a list if there is no > scrollbar even though pressing PageUp/Down using keyboard moves up/down the > list. > Issue stems from the fact that BasicScrollPaneUI.Handler.mouseWheelMoved() > skips the mouse wheel events when the scrollbar is not visible. > Fixed to handle mouseWheelEvent even though scrollbar is not visible with the > assumption that if both vertical and horizontal scrollbar is not visible, > then assume default orientation to be vertical. > > Existing jtreg, jck tests are ok. All L&F works well with the fix and > testcase works in all platforms except on mac which will be handled > separately. Why is the test excluded on macOS? What will happen when the vertical scrollbar is hidden but can be scrolled and the horizontal scrollbar is visible? test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java line 80: > 78: > scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); > 79: frame.add(scrollPane); > 80: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Suggestion: frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); It's safer for tests. test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java line 101: > 99: robot.mouseWheel(1); > 100: robot.delay(1000); > 101: if > (scrollPane.getViewport().getViewPosition().equals(viewPosition)) { This second call to `getViewPosition()` should also be on the EDT. ------------- PR: https://git.openjdk.java.net/jdk/pull/7585