It depends a little on the context, but you almost certainly want to call setDisable(...) .
In JavaFX, a node appears as disabled and ignores any user input if its disable property is true , or if the disable property is true for any ancestor in the scene graph. The disabled property, which is a read-only property for node clients, reflects this general state: i.e. disabled is true if and only if disable is true for this node or for any of its ancestor nodes (containers).
So, to disable node, you usually call setDisable(true); . In a custom subclass of Node you should only call setDisabled(true); to enforce the rule described above. Please note that the implementation of the superclass will already apply this rule, so if you are not doing something very complicated (I canβt even see an example of use), you will not need to call setDisabled(...) .
source share