When using a ListView control inside a SubScene node having many items for the user to scroll the items are not being refreshed. Typically, when using the wheel mouse or scroll thumb on the ListView control.
To reproduce run the following application code:
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.SubScene;
import javafx.scene.control.ListView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class ListViewRefreshViewBug extends Application {
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
SubScene subscene = new SubScene(root, 400, 500);
ObservableList list = FXCollections.observableArrayList();
for(int i=0; i<100; i++) {
list.add("hello " + i);
}
ListView listView = new ListView(list);
root.getChildren().add(listView);
Pane paneAsRoot = new Pane();
paneAsRoot.getChildren().add(subscene);
Scene scene = new Scene(paneAsRoot, 500, 550);
primaryStage.setTitle("ListView issue");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
To reproduce run the following application code:
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.SubScene;
import javafx.scene.control.ListView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class ListViewRefreshViewBug extends Application {
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
SubScene subscene = new SubScene(root, 400, 500);
ObservableList list = FXCollections.observableArrayList();
for(int i=0; i<100; i++) {
list.add("hello " + i);
}
ListView listView = new ListView(list);
root.getChildren().add(listView);
Pane paneAsRoot = new Pane();
paneAsRoot.getChildren().add(subscene);
Scene scene = new Scene(paneAsRoot, 500, 550);
primaryStage.setTitle("ListView issue");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}