Java Reference
In-Depth Information
Other important threads such as the prism rendering thread and the media event thread
collaborate with the JavaFX application thread to make graphics rendering and media
playback possible.
Long-running computations on the JavaFX application thread make JavaFX GUIs
unresponsive. They should be farmed out to background, or worker, threads.
The
Worker interface defines nine properties that can be observed on the JavaFX application
thread. It also defines a cancel() method.
Task<V> defines a one-time task for offloading work to background, or worker, threads and
communicates the results or exceptions to the JavaFX application thread.
Service<V> defines a reusable mechanism for creating and running background tasks.
ScheduledService<V> defines a reusable mechanism for creating and running background
tasks in a recurring fashion.
The
JFXPanel class is a JComponent that can put a JavaFX scene into a Swing application.
In a Swing JavaFX hybrid program, use
Platform.runLater() in Swing event listeners
to access the JavaFX scene, and use EventQueue.invokeLater() or SwingUtilities.
invokeLater() in JavaFX event handlers to access Swing widgets.
The
FXCanvas class is an SWT widget that can put a JavaFX scene into an SWT application.
In an SWT JavaFX hybrid program, the SWT UI thread and the JavaFX application thread are
one and the same.
The
SwingNode class is a JavaFX Node that can put a Swing component into a JavaFX
application.
Resources
Here are some useful resources for understanding this chapter's material:
The JavaFX architecture page on the JavaFX tutorials site: http://docs.oracle.com/
javase/8/javafx/get-started-tutorial/jfx-architecture.htm#JFXST788
The original JavaFX worker threading framework write-up on FX Experience:
http://fxexperience.com/2011/07/worker-threading-in-javafx-2-0/
The original JavaFX and SWT interoperability write-up on FX Experience:
http://fxexperience.com/2011/12/swt-interop/
 
Search WWH ::




Custom Search