How can I show an image using the ImageView component in javafx and fxml?

前端 未结 7 1972
感情败类
感情败类 2020-12-03 14:21

I suppose it\'s a very simple thing but I just can\'t get behind it. All I want is to show an image over an ImageView linked to fxml. Here is my code:

packag         


        
7条回答
  •  我在风中等你
    2020-12-03 15:14

    src/sample/images/shopp.png

    **
        Parent root =new StackPane();
        ImageView ımageView=new ImageView(new Image(getClass().getResourceAsStream("images/shopp.png")));
        ((StackPane) root).getChildren().add(ımageView);
    
    **
    

提交回复
热议问题