how do one pass a non-string object as argment using @namedArg in javafx? I cannot find a single nutshell example regarding this question online!
I am currently trying to instantiate a InlineCssTextArea from RichTextFX wrapped in a VirtualizedScrollPane - please have a look at this source code:
public VirtualizedScrollPane(@NamedArg("content") V content) {
[...]
}
where the custom type V is extending Node. In my case, I want to pass InlineCssTextArea as V. Doing this programmatically is pretty easy:
InlineCssTextArea area = new InlineCssTextArea();
Scene scene = new Scene(new StackPane(new VirtualizedScrollPane<>(area)), 600, 400);
but translating that to FXML is quite challenging. I have already tried a few things, like fx:factory based on the official oracle fxml tutorial:
<VirtualizedScrollPane fx:factory="content">
<InlineCssTextArea />
</VirtualizedScrollPane>
or how @namedArg suggests, as argument:
<VirtualizedScrollPane content="InlineCssTextArea" />
-or-
<VirtualizedScrollPane content="<InlineCssTextArea />" />
Is there a fxml solution for this problem?
my question is based on the the following answer from James D: What is the purpose of @NamedArg annotation in javaFX 8?