Simple question: Can I mix in my desktop application Java and JavaFX Script code? If it is possible could you provide me with some link with examples? Or could I pack my custom made javafx CustomNode-s in a jar and use them in my project side by side with standard SWING components?
6 Answers
Yes, you can mix Java and JavaFX.
According to one of the FAQ entries:
In addition, developers can use any Java library in their JavaFX applications. This allows JavaFX applications to take advantage of the rich JavaFX UI libraries, as well as the amazing breadth of functionality offered by Java.
The official source of information, including tools downloads, FAQ, and tutorials is the JavaFX web site.

- 30,725
- 9
- 56
- 64
This article gives an example of calling JavaFX from Java, using the Scripting API.

- 188,989
- 46
- 291
- 292
I suggest you to look at dotFX. It can be useful for you. It has a netbeans plugin,too.
Read first here for get more information.

- 338
- 3
- 7
You can use a JavaFX 2.0 with Swing http://javafx.com/about-javafx/
If you install the JavaFX 2.0 runtime first, then you launch an example http://download.oracle.com/otndocs/products/javafx/samples/SwingInterop/index.html

- 1,160
- 11
- 18
-
Yes using JFXPanel (a Swing panel that hosts JavaFX content). However, it does not support depth buffering which you'll need if you're doing any 3D stuff. See this bug. [link](http://javafx-jira.kenai.com/browse/RT-17446). Hopefully this will be resolved soon. – Adam Jan 14 '12 at 11:10
Yes Javafx and java apis can be mixed and used in your application without any problems.

- 1,860
- 19
- 30
Supposedly all you have to do is drag and drop the JavaFX application to your desktop in order to make it a desktop application. You can also use Java code in a JavaFX application. Not sure about the other way around.

- 3,261
- 4
- 29
- 43