如何启用或禁用JavaFX表单中的按钮? [英] How to Enable or Disable the buttons in JavaFX form?

查看:39
本文介绍了如何启用或禁用JavaFX表单中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理我的项目,有一些我想在运行时禁用的按钮.所以我禁用了它们,但是我想如何才能重新启用它们呢?因为没有 setEnable()属性.

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?

推荐答案

您正在寻找

You are looking for the disableProperty:

定义此节点的各个禁用状态.将禁用设置为true将导致此节点和所有子节点被禁用.这属性应仅用于设置节点的禁用状态.为了查询节点的禁用状态,disabled属性应而是使用它,因为有可能某个节点被禁用为祖先被禁用的结果,即使个人禁用该节点上的状态为false.

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

这篇关于如何启用或禁用JavaFX表单中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆