Does JavaFX lack a public Property.getObservable() method?

Randahl Fink Isaksen randahl at
Fri Sep 12 11:04:13 UTC 2014

I have noticed the lack of a getObservable() method of the property class, and I have come across a use case which might justify such a method, so I would like to discuss whether posting a new Jira issue for this is justified.

I have implemented a simple toggle button with two states, on and off. The toggle button has a SimpleBooleanProperty value, and when the user switches the toggle button the value is negated.

Now, in some cases I would like to bind the valueProperty to some observable boolean in my app, so that whenever that observable boolean is true, the button reflects that by switching to on. However, the problem is that if I bind the SimpleObjectProperty value to an observable boolean value, and then click the button to toggle it, a JavaFX exception tells me that I cannot negate the boolean value, since it is now bound.

In such cases, I think it makes sense to have my toggle button change the state of the value it is bound to instead. But since the SimpleBooleanProperty does not have a getObservable() method, I have no way of accessing the value observed.

Does this justify adding a public getObservable method to class Property?



More information about the openjfx-dev mailing list