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

ListView items moves when adding new items

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u25, 8u40
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      Win7 x64 with 32-bit JDK

      Description

      If you have a ListView where you add new items permanently (e.g. in a log viewer), the current visible items moves slowly out of the visible area.

      If you start the example below the list is filled with the first items and nothing changes except for the scroll bar.
      After you moved somewhere to the list's middle you can see the items scrolling down.
      If you move to the end of the list it scrolls to a new items automatically, thus moving out the current items quickly.
      The last behavior may be intentional, but it's not consistent.

      package sample;

      import javafx.animation.KeyFrame;
      import javafx.animation.Timeline;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ListView;
      import javafx.stage.Stage;
      import javafx.util.Duration;


      public class ListViewScrollSample extends Application {
      public static void main(String[] args) {
      launch(args);
      }

      @Override
      public void start(Stage stage) throws Exception {
      ListView<String> listView = new ListView<>();

      Timeline timeline = new Timeline(10, new KeyFrame(Duration.millis(10), evt -> {listView.getItems().add("line " + listView.getItems().size());}));
      timeline.setCycleCount(Timeline.INDEFINITE);
      timeline.play();

      stage.setScene(new Scene(listView, 200, 400));
      stage.show();
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: