0
votes

I have this problem:

I am using javaFX and scene builder (2.0) and I have placed scrollPane into my window, which in turn contains anchorPane. When I start my application everything works ok, but when I programmatically/dynamically add nodes into the anchorPane, for some reason whole layout of my app gets weird/buggy. Basically everything stays in the prefWidth and prefHeight and does not resize when resizing the app's window, while before adding for example Polyline into the anchorPane there wasn't any problem.

It affects practically all nodes (menubar, vertical toolbar) which aren't even in the anchorPane...

here is piece of my code:

   //initialize function of my cotroller class
   anchorPane = new AnchorPane();
   anchorPane.getChildren().add(canvas);
   scrollPane.setContent(anchorPane);
   ...

   //dynamic node insert
   Polyline polyline = new Polyline(...);
   ...
   anchorPane.getChildren.add(polyline);
   //and now the whole app's layout is bugged

Thanks for answers.

1

1 Answers

0
votes

I managed to fix it by changing AnchorPane to Pane.