I'm using the ControlsFX ToggleSwitch like so:
<ToggleSwitch fx:id="toggle" onAction="#handleToggleAction" mnemonicParsing="false" GridPane.columnIndex="1" /> I want to be able to associate actions on this ToggleSwitch with a method in my controller.
This is some of my code in the controller:
@FXML private void handleToggleAction(ActionEvent event) throws IOException { Boolean selected = ((ToggleSwitch) event.getSource()).isSelected(); if(selected) { //do something } else { //something else } } This is causing me an error:
Cannot determine type for property. I don't know why this is causing an error. Before using a ToggleSwitch I was using a ToggleButton and the handler method was working fine. Any help appreciated.