ADDITIONAL SYSTEM INFORMATION :
Windows 10, Java/JFX 11.0.20
A DESCRIPTION OF THE PROBLEM :
When attempting to scroll one above the top of the list view in JavaFX, an extra re-render with the dirty region being the full JavaFX window is done. In particular, scrolling must be done with the scroll wheel to reproduce
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use the sample code provided in this report.
2. Ensure that `prism.showdirty` is enabled.
3. Run and attempt to scroll down a few ticks. (ensure you are using the scroll wheel, not the scroll bar)
4. Scroll up to the first entry and then try scrolling one above that. An extra re-render will be done with the dirty region matching the full size of the window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No re-render to be performed when trying to scroll outside of the list's bounds.
ACTUAL -
Re-render performed when trying to scroll one above the top of the list view.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestListViewJavaFX extends Application {
@Override
public void start(Stage primaryStage) {
var items = FXCollections.<String>observableArrayList();
for (int i = 0; i < 100; i++) {
items.add("Item " + i);
}
var listView = new ListView<>(items);
listView.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setGraphic(null);
} else {
var hbox = new HBox();
hbox.setPrefHeight(50.0);
var label = new Label(item);
hbox.getChildren().add(label);
setGraphic(hbox);
}
}
});
listView.setPrefWidth(805.0);
listView.setPrefHeight(720.0);
var scene = new Scene(new VBox(listView), 1350, 900);
primaryStage.setTitle("ListView Example");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
System.setProperty("prism.order", "sw");
System.setProperty("javafx.pulseLogger", "true");
System.setProperty("javafx.pulseLogger.threshold", "-1");
System.setProperty("prism.showdirty", "true");
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Adding a tiny epsilon to the preferred height of the cell (say 0.001, 0.01, 0.1, etc) seems to fix the problem completely somehow.
FREQUENCY : always
Windows 10, Java/JFX 11.0.20
A DESCRIPTION OF THE PROBLEM :
When attempting to scroll one above the top of the list view in JavaFX, an extra re-render with the dirty region being the full JavaFX window is done. In particular, scrolling must be done with the scroll wheel to reproduce
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use the sample code provided in this report.
2. Ensure that `prism.showdirty` is enabled.
3. Run and attempt to scroll down a few ticks. (ensure you are using the scroll wheel, not the scroll bar)
4. Scroll up to the first entry and then try scrolling one above that. An extra re-render will be done with the dirty region matching the full size of the window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No re-render to be performed when trying to scroll outside of the list's bounds.
ACTUAL -
Re-render performed when trying to scroll one above the top of the list view.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestListViewJavaFX extends Application {
@Override
public void start(Stage primaryStage) {
var items = FXCollections.<String>observableArrayList();
for (int i = 0; i < 100; i++) {
items.add("Item " + i);
}
var listView = new ListView<>(items);
listView.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setGraphic(null);
} else {
var hbox = new HBox();
hbox.setPrefHeight(50.0);
var label = new Label(item);
hbox.getChildren().add(label);
setGraphic(hbox);
}
}
});
listView.setPrefWidth(805.0);
listView.setPrefHeight(720.0);
var scene = new Scene(new VBox(listView), 1350, 900);
primaryStage.setTitle("ListView Example");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
System.setProperty("prism.order", "sw");
System.setProperty("javafx.pulseLogger", "true");
System.setProperty("javafx.pulseLogger.threshold", "-1");
System.setProperty("prism.showdirty", "true");
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Adding a tiny epsilon to the preferred height of the cell (say 0.001, 0.01, 0.1, etc) seems to fix the problem completely somehow.
FREQUENCY : always