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

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

    @FXML
    ImageView image;
    
    @Override
    public void initialize(URL url, ResourceBundle rb) {
      image.setImage(new Image ("/about.jpg"));
    }
    

提交回复
热议问题