What I really love about Java is that, It can run on various devices. In college projects, I used Swing and AWT for creating GUI applications in Java and It was so fun to run the output jar file on multiple operating systems. One thing that I missed so much, was a nice and a visually appealing UI (User Interface) controls. Swing’s UI controls feels so classic in comparison with VB.net (Microsoft’s framework for building Rich Applications).
When I completed my college project, I never used it again. Recently, I heard about JavaFX (A software platform for creating and delivering desktop applications, as well as rich internet applications (RIAs) that can run across a wide variety of devices.), It has eye-catching UI controls and considered as the replacement of Swing.
JavaFX was first released in 2008 which used a statically typed declarative language called JavaFX Script. When JavaFX 2.0, released in 2011, It dropped the support for JavaFX Script and supported writing JavaFX programs using the Java programming language. This caught the Java community’s attention.
Some Features of JavaFX :
JavaFX has properties and binding:
JavaFX properties are similar to the familiar JavaBeans properties with getters and setters. JavaFX Properties store the inner state of a control and allows to listen the state changes. This helps to perform an action when the property value changes. Binding helps to synchronize the value of two or more properties.
JavaFX includes 3D support:
The JavaFX 3D graphics APIs provide a general purpose three-dimensional graphics library for the JavaFX platform. We can use 3D geometry, cameras, and lights to create, display, and manipulate objects in 3D space.
JavaFX provides support for multitouch operations, based on the capabilities of the underlying platform
JavaFX is based on a scene graph model:
The JavaFX Scene Graph API makes graphical user interfaces easier to create, especially when complex visual effects and transformations are involved. The JavaFX scene graph is a retained mode API, meaning that it maintains an internal model of all graphical objects in your application. At any given time, it knows what objects to display, what areas of the screen need repainting, and how to render it all in the most efficient manner. Instead of invoking primitive drawing methods directly, you instead use the scene graph API and let the system automatically handle the rendering details.
JavaFX scenes can be defined with FXML:
JavaFX features a language known as FXML, which is a HTML like declarative markup language, lets you define JavaFX scene graphs. JavaFX controller classes manage dynamic content and event handlers. This division of FXML and controller class helps separate the view and controller.
JavaFX can be styled with CSS:
CSS is widely used in Web Design, Now you can provide your own CSS styling to JavaFX as well.
JavaFX has a WebView:
High-performance Media Engine:
JavaFX supports the playback of web multimedia content. It provides a stable, low-latency media framework that is based on the GStreamer multimedia framework.
Compatible with Swing code:
You can embed Swing content using the Swing Node class in JavaFX Application. Similarly, you can update the existing Swing applications with JavaFX features like embedded web content and rich graphics media
JavaFX can be used with a Scene Builder:
A Scene Builder is a visual tool to create User controls with a drag and drop design interface similar to those in a Visual Studio. It can be integrated in IDE’s such as Eclipse and NetBeans and used to develop FXML applications. Gluon provides the scene builder here.
JavaFX has charts
JavaFX comes with built in libraries to visualize your data so, you don’t have to use third-party charts. The JavaFX API comes standard with a charts package that includes several chart types such as Pie Chart, Bar Chart Line Chart, Bubble Chart, Scatter Chart, Area Chart, Stacked Area Chart and Stacked Bar Chart.