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

前端 未结 7 1962
感情败类
感情败类 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:18

    It's recommended to put the image to the resources, than you can use it like this:

    imageView = new ImageView("/gui.img/img.jpg");
    

提交回复
热议问题