From f22ef61d3c26b4a7f07eee2a3fe11b3cc220c332 Mon Sep 17 00:00:00 2001 From: giavaphi Date: Sun, 30 Oct 2022 18:06:18 +0100 Subject: [PATCH] #42 bug resize window fix --- .../ch/zhaw/gartenverwaltung/MainFXMLController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/zhaw/gartenverwaltung/MainFXMLController.java b/src/main/java/ch/zhaw/gartenverwaltung/MainFXMLController.java index c3fe04d..58ea2eb 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/MainFXMLController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/MainFXMLController.java @@ -62,15 +62,17 @@ public class MainFXMLController implements Initializable { * @throws IOException exception when file does not exist */ public void loadPane(String fxmlFile) throws IOException { - //ToDo HGrow and VGrow of new node - Node node; + AnchorPane anchorPane; FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile))); - node = (Node)loader.load(); + anchorPane = loader.load(); if(fxmlFile.equals("MyPlants.fxml")) { MyPlantsController myPlantsController = loader.getController(); myPlantsController.getMainController(this); } - mainPane.getChildren().setAll(node); + mainPane.getChildren().setAll(anchorPane); + anchorPane.prefWidthProperty().bind(mainPane.widthProperty()); + anchorPane.prefHeightProperty().bind(mainPane.heightProperty()); + } private void styleChangeButton(Button button) {