Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8096847

ScrollEvent not fired in ListView, TableView, ScrollPane etc.


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8u25
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Environment:

      Windows 7 Enterprise 64-bit, JDK1.8-25


      When I register a handler for a ListView by calling listView.setOnScroll(...), my handler would never be called with the exception of scrolling by mouse wheel beyond the scroll limits.

      My thought of setOnScroll is, that the handler get called when the user scrolls the content by ScrollBar, mouse wheel (or gesture) and also by keyboard. Please correct me if I misunderstood the method signature.

      Here is a code snippet to test the (in my opinion) wrong behavior. I think the "mistake" happens in VirtualFlow by consuming ScrollEvent.

      package simplescrolltest;

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.ListView;
      import javafx.scene.input.ScrollEvent;
      import javafx.scene.layout.AnchorPane;
      import javafx.stage.Stage;

      public class SimpleScrollApp extends Application {
          private final ObservableList<String> data = FXCollections.observableArrayList();
          public void start(Stage primaryStage) {
              for (int i = 0; i < 100; i++) {
                  data.add(String.format("ScrollMe " + i));

              ListView listView = new ListView();
              listView.setOnScroll((ScrollEvent event) -> {
                  // This event handler is called only if we scroll by mouse wheel beyond the limits.
                  // No scrolling from ScrollBar nor KeyBoard (PageUp/Down) is handled.
                  System.out.println("ListView.onScroll handler called: " + event);
              AnchorPane root = new AnchorPane();
              AnchorPane.setTopAnchor(listView, 0.0);
              AnchorPane.setBottomAnchor(listView, 0.0);
              AnchorPane.setLeftAnchor(listView, 0.0);
              AnchorPane.setRightAnchor(listView, 0.0);
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Hello World!");

          public static void main(String[] args) {




            • Assignee:
              jgiles Jonathan Giles
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: