title: Background image in JavaFX
body: <p>I am trying to get a background image to load in a javaFX scene. The answers I have found on here are not working. The window opens, but it is blank (no image).</p>
  
  <pre><code>public class FirstFX extends Application {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage stage) throws Exception {
          StackPane root = new StackPane();
          BackgroundImage myBI= new BackgroundImage(new Image("SnLBoard.png"),
              BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
          root.setBackground(new Background(myBI));
          stage.show();
      }
  }
  </code></pre>