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) {