title: JavaFx: How i can bind a stage with screen resolution?
body: <p>I'm working on javaFx project,i created on my laptop ,every thing is well ,but when i changed my screen , now i use large screen , i found that my application affected with screen resolution some components do not fit on the screen.
  This is my code : </p>
  
  <pre><code> try {
  
                          FXMLLoader fxm = new FXMLLoader(getClass().getResource("Home.fxml"));
  
                          //Load th file XML To parent
                          Parent parent = (Parent) fxm.load();
                          //Create a new stage         
  
                          s.setTitle("PubWorks 1.0");
                          s.getIcons().add(new Image("/Images/Casque.png"));
  
                          Scene scene = new Scene(parent);
                          s.setScene(scene);
                          s.centerOnScreen();
                          ((Node) event.getSource()).getScene().getWindow().hide();
                          s.show();
                          s.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() {
                              @Override
                              public void handle(WindowEvent event) {
                                  new RecentMessageDao().Delete(new RecentMessage(0));
                                  User user = new User(UserTxt.getText(), PasswordTxt.getText());
                                  new UserDao().setOff(user);
                                  System.exit(0);
  
                              }
                          });
                          MenuController controller = fxm.getController();
                          controller.getMenuController(s);
  
                      } catch (Exception exception) {
                          exception.printStackTrace();
  
                      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ne3l6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ne3l6.png" alt="enter image description here"></a></p>
  
  <p>This is my parent layout</p>
  
  <pre><code>&lt;AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="710.0" prefWidth="1360.0" styleClass="mainFxmlClass" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hmproject.MenuController"&gt; ........&lt;/AnchorPane&gt;
  </code></pre>