Binding Image in Javafx


In my Javafx application, I have a gallery. What I want to do is that, as soon as an Image is available available in a folder, it should show that Image on the screen.

Is there anyway to bind an Image in an IamgeView. Just like any other String or Property? I can have something called ImageProperty and it will be binded to the Image. So if I change the image in the ImageProperty, it will update the UI

2/4/2013 8:25:06 AM

Accepted Answer

Done. ImageView has an Object Property to which an ObjectProperty can be binded.


private ObjectProperty<javafx.scene.image.Image> imageProperty = new SimpleObjectProperty<>();
private ImageView imageDisplay;
Bindings.bindBidirectional(this.imageDisplay.imageProperty(), GlobalModel.getInstance().getProject().getImageProperty());
2/4/2013 9:10:30 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow