title: Set StackPane background image
body: <p>I want to set background image autoresized with StackPane.</p>
  
  <p>I tried this:</p>
  
  <pre><code>StackPane stackPane = new StackPane();
  Image im = new Image(Dashboardpanel.class.getResource("/images/11.jpg").toExternalForm()); 
  stackPane.setBackground(new Background(new BackgroundImage(im, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
  </code></pre>
  
  <p>But the image is not auto-resized when I resize the StackPane. The image is repeated to fill the gap. How I can resize the image just as the Stackpane no matter how I extend the StackPane?</p>