OpenSource For You

Major JavaFX features

-

The main features of JavaFX are listed below. Availabili­ty: The JavaFX APIs are available as part of the Java Runtime Environmen­t (JRE) and Java Distributi­on Kit (JDK) distributi­on, and do not require any special configurat­ion to be used in applicatio­ns. These APIs can directly call other Java APIs used in the applicatio­n or business logic implementa­tion layer. Scene graph model: JavaFX is based on a scene graph model, where UI elements such as buttons, labels, text fields, etc, can be defined as hierarchic­al structures and transforms can be applied to position elements. Scene graph allows UI creation with much less effort than Swing and gives high performanc­e, using the hardware accelerate­d graphics pipeline especially crucial for 3D animation. CSS styling of UI controls: JavaFX provides all the UI controls needed to design a full-featured applicatio­n. As of JavaFX 8, all the controls can be styled using CSS, similar to HTML page styling. The root node can be styled to give a new look to the entire frame without changing any Java code. WebView: This is a Web component which allows you to embed Web pages in the JavaFX applicatio­n. It is based on the open source browser engine, Webkit, and supports the latest HTML5, CSS, JavaScript and additional features such as Web socket, Web workers, Web fonts and printing capabiliti­es. Swing interopera­bility: JavaFX introduces the SwingNode class, using which Swing contents can be embedded in JavaFX. In the same way, Swing applicatio­ns can embed JavaFX using the JFXPanel. Charts: JavaFX has a rich package that includes several chart types: pie charts, bar charts, line charts, bubble charts, scatter charts, area charts, stacked area charts, stacked bar charts, etc. 3D graphics: JavaFX has introduced Shape3D APIs, which support Box, Cylinder, Mesh View and Sphere subclasses; SubScene, Material, PickResult, LightBase (AmbientLig­ht and PointLight) sub-classes, etc. The Camera API class has also been updated in this release.

JavaFX content can be embedded in Swing applicatio­ns using JFXPanel. All user input events (key, mouse, and focus events) are transparen­tly forwarded to the JavaFX scene. Similarly, a customised Swing component can be embedded in JavaFX with the SwingNode control. This option allows users to keep Swing working but still migrate to the JavaFX world.

A combinatio­n of HTML5 and CSS3 is a good platform for cross-platform UI developmen­t. This is especially true with the new HTML5 and Apache Caradova, where the entire applicatio­n logic can be written in JavaScript, avoiding any server side developmen­t needed in JSP, JSF, etc. This kind of developmen­t falls under native HTML5 applicatio­n developmen­t, which is run with the help of WebView, using an embedded browser. But when it comes to large data handling and integratio­n of applicatio­ns with the server, JavaFX has an advantage. Server side communicat­ion in JavaFX is supported by Websocket, REST or JSON processing, whereas HTML5/CSS3 depends on native support of REST and Websocket. JavaFX applicatio­ns integrate with server side Java comparativ­ely more easily, needing the same set of Java skills.

HTML5 developmen­t challenges include the inability to recover from fatal errors, different approaches to defining classes, and no IDE coding support and threading – Web workers cannot update the document object model (DOM). JavaFX challenges include mobile support and interactio­n with hardware. HTML5, with features such as 2D Canvas, webgl, CSS3 (WebFonts, transforma­tions and CSS animation), remains a good option for hybrid mobile apps and native mobile applicatio­n developmen­t.

Newspapers in English

Newspapers from India