JavaFX Architecture - JavaFX

What is JavaFX Architecture?

JavaFX presents a entire API with a rich set of classes and interfaces to build GUI programs with rich graphics. The essential packages of this API are −

  • javafx.animation − includes classes to add transition based animations including fill, fade, rotate, scale and translation, to the JavaFX nodes.
  • javafx.application − contains a set of classes responsible for the JavaFX application life cycle.
  • javafx.css − contains classes to add CSS–like styling to JavaFX GUI applications.
  • javafx.event − contains instructions and interfaces to deliver and manage JavaFX events.
  • javafx.geometry − consists of lessons to outline 2d objects and carry out operations on them.
  • javafx.stage − This package holds the top level container instructions for JavaFX application.
  • javafx.scene − This package presents classes and interfaces to help the scene graph. in addition, it also presents sub-programs which include canvas, chart, manage, effect, image, enter, layout, media, paint, shape, text, transform, web, etc. There are several components that help this rich API of JavaFX.

The following example suggests the architecture of JavaFX API. here you may see the components that assist JavaFX API.

JavaFX - Architecture

Scene Graph

In JavaFX, the GUI applications had been coded using a Scene Graph. A Scene Graph is the starting point of the development of the GUI application. It holds the (GUI) application primitives that are termed as nodes.

A node is a visual/graphical object and it could include −

  • Geometrical (Graphical) objects − (2d and 3D) including circle, rectangle, polygon, etc.
  • UI controls − such as Button, Checkbox, preference box, text region, etc.
  • containers − (layout panes) including Border Pane, Grid Pane, flow Pane, etc.
  • Media elements − such as audio, video and image objects.

In general, a set of nodes makes a scene graph. all these nodes are arranged in a hierarchical order as shown below.

JavaFX - Architecture

Each node inside the scene graph has a single parent, and the node which does not include any parents is known as the root node.

In the same manner, each node has one or more children, and the node without children is called as leaf node; a node with children is called as a branch node.

A node example can be brought to a scene graph only as soon as. The nodes of a scene graph will have results, Opacity, Transforms, event Handlers, event Handlers, application particular States.

Prism

Prism is a high performance hardware–accelerated graphical pipeline this is used to render the graphics in JavaFX. it could render both 2-D and 3-D graphics.

To render graphics, a Prism uses −

  • DirectX 9 on windows XP and Vista.
  • DirectX 11 on windows 7.
  • OpenGL on Mac and Linux, Embedded systems.

In case the hardware assist for graphics at the system is not enough, then Prism uses the software render path to method the graphics.

When used with a supported graphic Card or GPU, it gives smoother graphics. simply in case the system does not help a graphic card, then Prism defaults to the software rendering stack (both of the above two).

GWT (Glass Windowing Toolkit)

As the name shows, GWT presents services to control 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 may also embed HTML content in to a scene graph. WebView is the aspect of JavaFX which is used to method this content. It uses a technology called web kit, which is an inner open-source web browser engine. This aspect helps unique web technology like HTML5, CSS, JavaScript, DOM and SVG.

Using WebView, you may −

  • Render HTML content from local or remote URL.
  • Support history and offer back and forward navigation.
  • Reload the content.
  • Apply effects to the web element.
  • Edit the HTML content.
  • Execute JavaScript commands.
  • Handle events.

In preferred, using WebView, you can manage web content from Java.

Media Engine

The JavaFX media engine is based on an open-source engine referred to as a Streamer. This media engine helps the playback of video and audio content.

The JavaFX media engine presents assist for audio for the following file formats –

JavaFX - Architecture

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, that are −

  • Media object − This represents a media file
  • Media player − To play media content.
  • Media View − To display media.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JavaFX Topics