KD Palekar KD Palekar - 1 year ago 210
Java Question

How to Enable or Disable the buttons in JavaFX form?

I am working on my project and there are some buttons that I wanted to disable at the time of running. So I disabled them but How can I enable them back when I wanted to.?? Because there is no


Please tell me how can I enable the buttons?

enter image description here

enter image description here

Answer Source

You are looking for the disableProperty:

Defines the individual disabled state of this Node. Setting disable to true will cause this Node and any subnodes to become disabled. This property should be used only to set the disabled state of a Node. For querying the disabled state of a Node, the disabled property should instead be used, since it is possible that a Node was disabled as a result of an ancestor being disabled even if the individual disable state on this Node is false.

setDisable(true); // will disable the Button
setDisable(false); // will enable it again
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download