I would like to interact (as transparently as possible from the Java point of view) with the controls of a JavaFX application from an application in a foreign language (Prolog). Java and Prolog are connected by means of JNI and I have already resolved the JNI interaction issues.
My question is:
What is the best way to instrument an arbitrary JavaFX application so I could inject code somewhere to invoke a routine in Prolog immediately after the primary Stage has been instantiated ? (so Prolog will be able to refer to the nodes in the Scene Graph of the Stage).
I think Scenic View does something similar using agents to instrument a bit an arbitrary JavaFX application that does not have any code related to Scenic View.
In my problem, the objective is that the JavaFX interface could be created without JNI related code and having only presentation logic. The code starting the Prolog program with JNI should be somehow injected after the interface is ready. So the idea is to use Java only for the interface of my program and the core logic of my application is implemented in Prolog.