I want to create an application with FXML with two custom controls, where one of them needs a reference to the other.
The first class gets the reference to the second class via a constructor argument. This is also available in the FXML with the @NamedArgs
annotation.
public SelectWeekControl(@NamedArg("dayControl") SelectDayControl selectDayControl) {
this.selectDayControl = selectDayControl;
...
}
Now I want to add both to the FXML file by referencing the @NamedArgs
field with the fx:id
of the other component.
<SelectDayControl fx:id="daySelect"/>
<SelectWeekControl dayControl="${daySelect}" fx:id="weekSelect"/>
Unfortunately the second line fails with the following error message:
Caused by: javafx.fxml.LoadException: Cannot bind to untyped object.
The only other question referring to the same issue has an unsatisfying answer.