I want to set an image on an imageview,selecting file from filechooser I used imageView.setImage(file), which prompts an error saying "File cannot be converted to Image"
here's my code:
@FXML
private AnchorPane mainAnchorpane;
@FXML
private ImageView iconimageview;
private File iconimage;
 @FXML
public void iconimagebuttonAction(ActionEvent event) {
    FileChooser filechooser = new FileChooser();
    iconimage = filechooser.showOpenDialog(mainAnchorpane.getScene().getWindow());
    System.out.println(iconimage.getName());
    if (iconimage != null) {
        String iconimagepath = iconimage.getAbsolutePath();
        System.out.println(iconimagepath);
        iconimageview.setImage(iconimage);
    }
}