JavaFX Architecture
JavaFX Architecture
JavaFX Architecture
The following illustration shows the architecture of JavaFX API. Here you can see the components
that support JavaFX API.
Scene Graph
In JavaFX, the GUI Applications were coded using a Scene Graph. A Scene Graph is the starting point
of the construction of the GUI Application. It holds the (GUI) application primitives that are termed
as nodes.
Geometrical (Graphical) objects − (2D and 3D) such as circle, rectangle, polygon, etc.
Containers − (layout panes) such as Border Pane, Grid Pane, Flow Pane, etc.
In general, a collection of nodes makes a scene graph. All these nodes are arranged in a hierarchical
order as shown below.
Each node in the scene graph has a single parent, and the node which does not contain any parents
is known as the root node.
In the same way, every node has one or more children, and the node without children is termed
as leaf node; a node with children is termed as a branch node.
A node instance can be added to a scene graph only once. The nodes of a scene graph can have
Effects, Opacity, Transforms, Event Handlers, Event Handlers, Application Specific States.
Prism
Prism is a high performance hardware–accelerated graphical pipeline that is used to render the
graphics in JavaFX. It can render both 2-D and 3-D graphics.
DirectX 11 on Windows 7.
In case the hardware support for graphics on the system is not sufficient, then Prism uses the
software render path to process the graphics.
When used with a supported Graphic Card or GPU, it offers smoother graphics. Just in case the
system does not support a graphic card, then Prism defaults to the software rendering stack (either
of the above two).
As the name suggests, GWT provides services to manage Windows, Timers, Surfaces and Event
Queues. GWT connects the JavaFX Platform to the Native Operating System.
Quantum Toolkit
It is an abstraction over the low-level components of Prism, Glass, Media Engine, and Web Engine. It
ties Prism and GWT together and makes them available to JavaFX.
WebView
Using JavaFX, you can also embed HTML content in to a scene graph. WebView is the component of
JavaFX which is used to process this content. It uses a technology called Web Kit, which is an internal
open-source web browser engine. This component supports different web technologies like HTML5,
CSS, JavaScript, DOM and SVG.
Handle events.
In general, using WebView, you can control web content from Java.
Media Engine
The JavaFX media engine is based on an open-source engine known as a Streamer. This media
engine supports the playback of video and audio content.
The JavaFX media engine provides support for audio for the following file formats −
MP3
Audio WAV
AIFF
Video FLV
The package javafx.scene.media contains the classes and interfaces to provide media functionality in
JavaFX. It is provided in the form of three components, which are −
// Writing to - gfgOutput.txt
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
// Class
class GFG {
// IOException
try {
// through an IOException
int i;
// of the file
// Condition check
str += (char)i;
System.out.println(str);
// FileWriter object
fw.write(str);
fr.close();
fw.close();
// Display message
System.out.println(
catch (IOException e) {
// Display message
System.out.println(