Issue
How can I set up a change listener for an ImageView's image property?
//dstOne is an ImageView
dstOne.imageProperty().addListener(new ChangeListener<Boolean>() {
public void changed() {
}
});
Solution
public void changed()
is not the correct method signature for the ChangeListener interface. The image
property is not a Boolean either. Fix that. This is the interface method:
void changed(ObservableValue<? extends T> observable, T oldValue, T newValue)
For the image property the type (T
) is Image.
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/ImageView.html#imageProperty
Using any decent IDE, the correct method signature could have been completed for you.
Answered By - swpalmer
Answer Checked By - Mary Flores (JavaFixing Volunteer)