问题
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