Run this sample that creates a simple TreeView with several nodes and children :
"
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.layout.VBox;
public class TreeViewSample extends Application {
TreeItem<String> rootNode = new TreeItem<String>("MyCompany Human Resources");
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
for (int i = 0; i < 5; ++i) {
TreeItem<String> empLeaf = new TreeItem<String>("test");
empLeaf.setExpanded(true);
rootNode.getChildren().add(empLeaf);
addFiveItems(empLeaf);
}
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
TreeView<String> treeView = new TreeView<String>(rootNode);
treeView.setShowRoot(true);
treeView.setEditable(true);
box.getChildren().add(treeView);
stage.setScene(scene);
stage.show();
}
private void addFiveItems(TreeItem root) {
for (int i = 0; i < 5; ++i) {
TreeItem<String> empLeaf = new TreeItem<String>("test");
root.getChildren().add(empLeaf);
}
}
}
"
Then without clicking anywhere, just scroll to the very bottom with your mouse wheel.
Then go up one time with one step of mouse wheel.
And go down quickly with several "step" of mousewheel.
You will see that some TreeItem on the top becomes blank.
Don't hesitate to reproduce several times in order to catch that phenomenon.
"
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.layout.VBox;
public class TreeViewSample extends Application {
TreeItem<String> rootNode = new TreeItem<String>("MyCompany Human Resources");
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
for (int i = 0; i < 5; ++i) {
TreeItem<String> empLeaf = new TreeItem<String>("test");
empLeaf.setExpanded(true);
rootNode.getChildren().add(empLeaf);
addFiveItems(empLeaf);
}
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
TreeView<String> treeView = new TreeView<String>(rootNode);
treeView.setShowRoot(true);
treeView.setEditable(true);
box.getChildren().add(treeView);
stage.setScene(scene);
stage.show();
}
private void addFiveItems(TreeItem root) {
for (int i = 0; i < 5; ++i) {
TreeItem<String> empLeaf = new TreeItem<String>("test");
root.getChildren().add(empLeaf);
}
}
}
"
Then without clicking anywhere, just scroll to the very bottom with your mouse wheel.
Then go up one time with one step of mouse wheel.
And go down quickly with several "step" of mousewheel.
You will see that some TreeItem on the top becomes blank.
Don't hesitate to reproduce several times in order to catch that phenomenon.
- relates to
-
JDK-8093666 [TableView] TableView vertical mouse wheel scrolling does not go to the bottom (screen at a time or fast wheel setting)
- Resolved