I want a ScrollPane in my application window which doesn't fill the whole scene, but only takes up part of it, because I want to place a button beneath it.
Like in this sketch: https://i.imgur.com/eUA7Af7.png
I tried using a GridPane, but I can only put Nodes as children of the GridPane, which doesn't work because the ScrollPane is not a Node.
public void start(Stage stage) throws Exception {
var root = new GridPane();
var scene = new Scene(root, 400, 400);
var scrollPane = new ScrollPane();
root.add(scrollPane, 0, 0); // Not possible
var button = new Button();
root.add(button, 0, 1);
stage.setScene(scene);
stage.show();
}
javafx.scene.control.ScrollPanedefinitely is ajavafx.scene.Node. The class hierarchy is:ScrollPane→Control→Region→Parent→Node. There's nothing obviously wrong with the code you've shown us; if you're having problems please provide a minimal reproducible example demonstrating the issue. - Slaw