-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
jfx19, jfx19.0.2
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Cell is not displayed when scrolling to the end of ListView with many cells.
300 cells was fine.
Problems arise when the number of cells exceeds 500-1000.
The following log is output when this problem occurs.
> javafx.scene.control.skin.VirtualFlow addTrailingCells
> INFO: index exceeds maxCellCount. Check size calculations for class javafx.scene.control.skin.ListViewSkin$2
This issue occurs in JavaFX 19. It works fine with JavaFX 11.
REGRESSION : Last worked in version 11.0.17
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(1) Add 1000 cells to ListView.
(2) Call "scrollTo" with the last index of the ListView.
(3) Cells in ListView are not drawn.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ListView cell is displayed.
ACTUAL -
ListView cells were not displayed.
---------- BEGIN SOURCE ----------
Cell is not displayed when scrolling to the end of ListView with many cells.
300 cells was fine.
Problems arise when the number of cells exceeds 500-1000.
The following log is output when this problem occurs.
> javafx.scene.control.skin.VirtualFlow addTrailingCells
> INFO: index exceeds maxCellCount. Check size calculations for class javafx.scene.control.skin.ListViewSkin$2
This issue occurs in JavaFX 19. It works fine with JavaFX 11.
//
// Sample.java
//
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
public class Sample extends Application {
@FXML private Button button;
@FXML private ListView listView;
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Sample.fxml"));
loader.setController(this);
Parent root = loader.load();
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
button.setOnAction(this::button_onAction);
List<String> items = new ArrayList<>();
for(int i = 1; i <= 1000; i++) {
items.add(Integer.toString(i));
}
listView.setItems(FXCollections.observableList(items));
}
private void button_onAction(ActionEvent event) {
int lastIndex = listView.getItems().size() - 1;
listView.scrollTo(lastIndex);
}
}
//
// Sample.fxml
//
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
prefHeight="400.0" prefWidth="600.0">
<Button fx:id="button" text="SCROLL" />
<ListView fx:id="listView"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="32.0"
AnchorPane.bottomAnchor="0.0" />
</AnchorPane>
---------- END SOURCE ----------
FREQUENCY : always
Cell is not displayed when scrolling to the end of ListView with many cells.
300 cells was fine.
Problems arise when the number of cells exceeds 500-1000.
The following log is output when this problem occurs.
> javafx.scene.control.skin.VirtualFlow addTrailingCells
> INFO: index exceeds maxCellCount. Check size calculations for class javafx.scene.control.skin.ListViewSkin$2
This issue occurs in JavaFX 19. It works fine with JavaFX 11.
REGRESSION : Last worked in version 11.0.17
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(1) Add 1000 cells to ListView.
(2) Call "scrollTo" with the last index of the ListView.
(3) Cells in ListView are not drawn.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ListView cell is displayed.
ACTUAL -
ListView cells were not displayed.
---------- BEGIN SOURCE ----------
Cell is not displayed when scrolling to the end of ListView with many cells.
300 cells was fine.
Problems arise when the number of cells exceeds 500-1000.
The following log is output when this problem occurs.
> javafx.scene.control.skin.VirtualFlow addTrailingCells
> INFO: index exceeds maxCellCount. Check size calculations for class javafx.scene.control.skin.ListViewSkin$2
This issue occurs in JavaFX 19. It works fine with JavaFX 11.
//
// Sample.java
//
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
public class Sample extends Application {
@FXML private Button button;
@FXML private ListView listView;
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Sample.fxml"));
loader.setController(this);
Parent root = loader.load();
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
button.setOnAction(this::button_onAction);
List<String> items = new ArrayList<>();
for(int i = 1; i <= 1000; i++) {
items.add(Integer.toString(i));
}
listView.setItems(FXCollections.observableList(items));
}
private void button_onAction(ActionEvent event) {
int lastIndex = listView.getItems().size() - 1;
listView.scrollTo(lastIndex);
}
}
//
// Sample.fxml
//
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
prefHeight="400.0" prefWidth="600.0">
<Button fx:id="button" text="SCROLL" />
<ListView fx:id="listView"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="32.0"
AnchorPane.bottomAnchor="0.0" />
</AnchorPane>
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8296871 TableView scrollTo(lastRow) displays the last row at the top of the viewport
-
- Open
-