How to Enable or Disable the buttons in JavaFX form?

一笑奈何 提交于 2021-02-05 06:37:05

问题


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 setEnable() property.

Please tell me how can I enable the buttons?


回答1:


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


来源:https://stackoverflow.com/questions/40707131/how-to-enable-or-disable-the-buttons-in-javafx-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!