I'm working in a desktop application using javafx.
This is my code. The method telechargerImage()
is called when the user clicks on the button uploadimage
in order to choose an image and then I want to save it in localhost/images.
Excuse my english.
private Image imagelog;
@FXML
private ImageView image;
@FXML
private JFXButton uploadimage;
private FileChooser fileChooser = new FileChooser();
private File file = null;
void telechargerImage(ActionEvent event) {
File file = fileChooser.showOpenDialog(stage);
if (file != null) {
imagelog = new Image(file.toURI().toString());
image.setImage(imagelog);
}
}