title: JavaFX 8: How to be able to re-size window (stage) but keep inner elements at their positions?
body: <p>I have a project that has a 2 text areas and few buttons. The root pane is a AnchorPane. when resizing the window to smaller window, all the elements start overlap. What methods can fix this? (IGNORE THE NAME OF MY anchorpane, i got lazy)</p>
  
  <pre><code>    AnchorPane borderpane = new AnchorPane ();
  
      TextArea user_list = new TextArea();
      user_list.setPrefSize(150, 400);
      TextArea messages = new TextArea();
      messages.setPrefSize(350, 400);
      TextField typebox = new TextField();
      typebox.setPrefSize(425, 100);
  
      // put a shape over a text, over a shape
      StackPane send_container = new StackPane();
  
      Rectangle send_box = new Rectangle(75, 25);
      Label send_text = new Label("Send");
  
      send_container.getChildren().add(send_box);
      send_container.getChildren().add(send_text);
  
      AnchorPane.setLeftAnchor(messages, 25.0);
      AnchorPane.setTopAnchor(messages, 10.0);
      AnchorPane.setRightAnchor(user_list, 25.0);
      AnchorPane.setTopAnchor(user_list, 10.0);
  
      AnchorPane.setBottomAnchor(typebox, 25.0); 
      AnchorPane.setLeftAnchor(typebox, 25.0); 
      AnchorPane.setBottomAnchor(send_container, 25.0); 
      AnchorPane.setRightAnchor(send_container, 25.0); 
      borderpane.getChildren().addAll(messages, user_list, typebox,send_container );
  
  
      Scene scene = new Scene(borderpane, 600, 600);
      primaryStage.setMaxHeight(600);
      primaryStage.setMaxWidth(600);
  
      primaryStage.setScene(scene); 
      primaryStage.setTitle("Welcome");
      scene.getStylesheets().add(LoginWindow.class.getResource("Login.css").toExternalForm());
      primaryStage.show();
  </code></pre>