No consigo que se vea la imaen cargada en la ImageView.
@FXML
void cambiarImgPerfil(ActionEvent actionEvent) throwsjava.io.IOException{
FileChooser chooser = new FileChooser();
chooser.setTitle("Open File");
chooser.setInitialDirectory(new File(System.getProperty("user.home")));
chooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Image Files","*.bmp", "*.png", "*.jpg", "*.gif"));
File file = chooser.showOpenDialog(new Stage());
if(file != null) {
//String imagepath = file.toURI().toURL().toString();
Image image = new Image(file.toURI().toString());
imgPerfil = new ImageView(image);
System.out.println("height:"+image.getHeight()+"\nWidth:"+image.getWidth());
imgPerfil.setImage(image);
System.out.println(imgPerfil.isVisible());
}
else
{
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText("Please Select a File");
/*alert.setContentText("You didn't select a file!");*/
alert.showAndWait();
}
}