0

I wouldlike to display svg file in background :

  public void start(Stage primaryStage) throws Exception{
            this.primaryStage = primaryStage;
            Group root = new Group(); 
            primaryStage.setTitle("Test");
            primaryStage.setScene(new Scene(root,1920, 1080));
            primaryStage.setMaximized(true);
    
    
            FileInputStream input_background_template = new 
            FileInputStream("ressources/background/template_home.svg");
            ImageView img_background_template = new ImageView(new Image(input_background_template));
        
            root.getChildren().addAll(img_background_template)
            primaryStage.show();
}

But I have still nothing in my background ?

martin
  • 143
  • 1
  • 3
  • 9
  • You do not have a closing curly brace "}". – Dennis Kozevnikoff Jul 10 '20 at 16:38
  • @DennisKozevnikoff wrong copy paste... just edited thank you. – martin Jul 10 '20 at 16:40
  • 1
    From the [`Image` docs](https://openjfx.io/javadoc/14/javafx.graphics/javafx/scene/image/Image.html): "Supported image formats are BMP, GIF, JPEG, PNG". – James_D Jul 10 '20 at 16:44
  • [This answer](https://stackoverflow.com/questions/40753613/javafx-button-with-svg) will get you what you need. This guy wanted a button, but you can apply the concepts to any `Region`. – RonSiven Jul 11 '20 at 14:24

0 Answers0