#42 bug resize window fix

This commit is contained in:
giavaphi 2022-10-30 18:06:18 +01:00
parent f452b73233
commit f22ef61d3c
1 changed files with 6 additions and 4 deletions

View File

@ -62,15 +62,17 @@ public class MainFXMLController implements Initializable {
* @throws IOException exception when file does not exist * @throws IOException exception when file does not exist
*/ */
public void loadPane(String fxmlFile) throws IOException { public void loadPane(String fxmlFile) throws IOException {
//ToDo HGrow and VGrow of new node AnchorPane anchorPane;
Node node;
FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile))); FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile)));
node = (Node)loader.load(); anchorPane = loader.load();
if(fxmlFile.equals("MyPlants.fxml")) { if(fxmlFile.equals("MyPlants.fxml")) {
MyPlantsController myPlantsController = loader.getController(); MyPlantsController myPlantsController = loader.getController();
myPlantsController.getMainController(this); 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) { private void styleChangeButton(Button button) {