Im trying to invoke a method of a controller form another controller. But It gives me Null Pointer Exception saying that java.lang.reflect.InvocationTargetException.
Here is my first controller with the method:
public class FirstController implements Initializable {
@FXML
private AnchorPane pane;
...
}
Here is the method :
public void setFadeEffect(Effect effect) {
pane.setEffect(effect);
}
Here is my second controller:
public class SecondController implements Initializable {
@FXML
private Button myBtn;
...
@FXML
private void myAction(ActionEvent event) throws IOException {
FirstController ic = new FirstController();
ic.setFadeEffect(new GaussianBlur(10));
}
Can anyone suggest me a way to perform this action please..