is it possible to use (compiled) components written in javafx in an existing swing application ?
following your example, how would one be able to create an instance of MyJavaFXClass in a java class?
Basically there are three options (of which one does not work yet and one is not recommended): :-)
1) Use the JavaFXScriptEngine. The article explains it only briefly, but there are some links at the bottom.
2) Use reflection. AFAIK the JavaFX-reflection API is not done yet, but it is planned for the next milestone (early September).
3) Use the Java-constructor created during compilation of the JavaFX class. Although this is possible, I do not recommend it. The compiled code it is an implementation detail, which might change in the future.
It had been possible to create a ComponentWidget class in old JavaFX Script
which had getJComponent() function. Why something like this is not implemented in the current UI library?
... marked as unanswered since some additional questions occured (look further up :-)
Yes, check out this article to get some hints:
thanks for replying - after reading your article I think that the interfaces approach would suit my needs most, but does it also work on more complex components ? The following article http://stufffromjim.blogspot.com/2008/05/compiled-javafx-in-swing-applic... suggests that this is not trivial. What would be the best way to deal with a complex jfx component ?
Hmmm, I cannot really tell, what the problem of the author was, because the exception is not shown completely. It's a pretty old article, a lot of bugs in the compiler have been fixed since then.
I usually use the interface approach and so far it worked very well. If you have problems, just post them here and you'll get help.
OK, Thanks :-), IÂ´ll try this way.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.