This is in JavaFX:
I have a product dashboard that (in a sidebar) shows the photo of the currently selected product in a TableView. The data of that selected product can be edited in an additional window. The edition allows you to change the product's photography. This change is made by overwriting the original photo (that is, it changes the content of the file, not its name or its location on disk).
My problem is that when that photo is changed, when leaving the editing window, the dashboard does not reflect that change, it still shows the previous photo (which makes some sense because the name of the file remains the same), so first "clean" the photo that is already shown doing
fotoProducto.setImage(new Image(null)); // Esto si funciona
And then I upload the file again:
fotoProducto.setImage(new Image("archivo.jpg"));
However, the dashboard still shows the previous photo and not the new one.
As I said, what changes is the content of the image, not its name on disk (for example, it will always be called "image1.jpg"). Is there some type of cache that was cleaned or some way to force the ImageView to refresh and recognize the change in the contents of the file?
Thanks for any ideas.