How would I be able to set the background image to the size of the window when increasing or decreasing the window frame? Right now the image is a set size of 300,300 so when increasing the window the size stays the same. Here's a snippet of my code:
grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput,
loginButton);
grid.setMinSize(300,300);
grid.setMaxSize(300,300);
StackPane root = new StackPane(grid);
NumberBinding maxScale = Bindings.min(root.widthProperty().divide(300),
root.heightProperty().divide(300));
grid.scaleXProperty().bind(maxScale);
grid.scaleYProperty().bind(maxScale);
BackgroundImage myBI= new BackgroundImage(new Image("image.jpg", 300, 300,
false, true),
BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT,
BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
//then you set to your node
grid.setBackground(new Background(myBI));
Scene scene = new Scene(root, 300,300);
window.setScene(scene);
window.show();