javafx 8 fxml negation

荒凉一梦 提交于 2019-12-13 01:58:19

问题


Using FXML with JavaFx 8.

I have few ToggleButtons in toggleGroup, defined as:

<ToggleGroup fx:id="operater" />

I want to disable OK button, when no operater is selected. Actually, I want to negate the disable expression in ok button:

<Button disable="${operater.selectedToggle.selected}" fx:id="ok" text="OK" mnemonicParsing="false" onAction="#okClick"  >

I have tried with ! and with not(), but no success.

Thanks.


回答1:


You can use an expression binding:

disable="${!operater.selectedToggle.selected}"

operater is spelt operator.



来源:https://stackoverflow.com/questions/26539934/javafx-8-fxml-negation

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