Can I utilise the new functionality provided by the new JavaFX APIs directly from Java to the same extent as I would be able to using JavaFX Script?
Are all the underlying JavaFX APIs purely Java or JavaFX Script or a mix?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The JavaFX APIs are a mix of JavaFX and Java. The SDK comes with an archive src.zip which contains a part of the APIs (only the most basic classes are included, but things like javafx.scene are missing).
Calling JavaFX code from Java is not officially supported in JavaFX 1.x AFAIK. There’s a blog entry in the JavaFX blog that shows you how to do anyway it using unsupported APIs, but it’s complicated and won’t work this way in future versions.
There are two supported ways to use JavaFX from Java. Either you use the Scripting API to invoke JavaFX code, as shown in this article. Or, which is the most elegant solution IMHO, write the API-accessing code using JavaFX, define Java interfaces to interact with your JavaFX code from plain Java, and then implement those interfaces in JavaFX.