title: how to fit the background size into the window size in javafx?
body: <p>I tried to make the background size as the window size.
  but, It's quite picky. I didn't use the css file format.</p>
  
  <p>it's the part of main to implement the window.</p>
  
  <pre><code>public void start(Stage primaryStage) throws Exception {
      GameLoopManager loop = GameLoopManager.instance();
      Controller controller = new Controller(loop, primaryStage);
      loop.start(new MenuState());
      primaryStage.show();
  
      primaryStage.setFullScreen(true);
  
  
  }
  </code></pre>
  
  <p>and this is the parts of body to implement the background and stage.</p>
  
  <pre><code>private UISubScene optionSubScene;
  private UISubScene helpSubScene;
  private UISubScene creditsSubScene;
  private UISubScene buttonChooserScene;
  
  private UISubScene sceneToHide;
  
  List&lt;UIButton&gt; menuButtons;
  
  List&lt;ButtonPicker&gt; buttonsList;
  
  private BUTTON chosenButton;
  
  public MenuViewManager(Stage mainStage) {
      sound.backgroundMusic();
      menuButtons = new ArrayList&lt;&gt;();
      mainPane = new AnchorPane();
      mainScene = new Scene(mainPane);
      mainScene.setFill(null);
      mainStage.setScene(mainScene);
  
      super.mainStage = mainStage;
  
      createSubScenes();
      createButtons();
      createBackground();
      createLogo();
  
      super.mainStage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() {
          public void handle(WindowEvent we) {
              controller.stop();
          }
      });
      // mainStage.show();
  
  }
  
  private void createBackground() {
      Image backgroundImgae = new Image("main/resources/images/jxoPOUxa.gif",true);
      BackgroundImage background = new BackgroundImage(backgroundImgae, BackgroundRepeat.NO_REPEAT,
              BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);        
      mainPane.setBackground(new Background(background));
  
  
  }
  </code></pre>
  
  <p>I tired to use BackgroundSize.AUTO but, I can't.
  what should I do to get the solution?</p>
  
  <p>If, I can use the css format how to use that? but I can't rewrite and revise lots of codes because, mine is almost done and I'm integrating and debugging.</p>