JavaFX Tutorial - JavaFX Introduction

JavaFX is Java's next-generation graphical user interface toolkit.

JavaFX is a set of graphics and media APIs that we can use to create and deploy rich client applications.

JavaFX allows developers to rapidly build rich cross-platform applications. JavaFX supports modern GPUs through hardware-accelerated graphics.

JavaFX allows developers to combine graphics, animation, and UI controls in one single programming interfaces.


The JavaFX APIs are bundled with the Java SE Runtime Environment (JRE) and the Java Development Kit (JDK ).

JDK is available for all major desktop platforms, Windows, Mac OS X, and Linux. JavaFX applications can be compiled and run on all the major desktop platforms.

JDK for ARM platform includes the base, graphics and controls components of JavaFX.

Key Features

The following features are included in JavaFX.

  • JavaFX is written in Java and JavaFX application code can reference APIs from any Java library.
  • The look and feel of JavaFX applications can be customized. We can use Cascading Style Sheets (CSS) to style JavaFX applications. Graphic designers can customize the appearance and style through the CSS.
  • We can also describe the presentation aspects of the UI in the FXML scripting language and use Java to code the application logic.
  • By using JavaFX Scene Builder we can design the UI by drag and drop. Scene Builder then will create FXML markup that can be ported to an Integrated Development Environment (IDE) so that developers can add the business logic.
  • JavaFX has a control called WebView which can render complex web page. WebView supports JavaScript and we can call Javascript in the web page from Java APIs. WebView also Support additional HTML5 features, including Web Sockets, Web Workers, and Web Fonts. We can also print web page from WebView
  • Swing interoperability. Existing Swing applications can use JavaFX class, such as charts and WebView. We can also use SwingNode class to embed Swing content into JavaFX applications.
  • 3D Graphics Features. JavaFX supports Shape such as Box, Cylinder, MeshView, and Sphere subclasses, SubScene, Material, PickResult, AmbientLight and PointLight.
  • Canvas API. With Canvas API we can draw on JavaFX scene.
  • Printing API. The javafx.print package provides the classes for the JavaFX Printing API.
  • Rich Text Support. JavaFX supports enhanced text, including bi-directional text and complex text scripts, such as Thai and Hindu in controls, and multi-line, multi-style text.
  • Multitouch Support. JavaFX provides support for multitouch operations.
  • JavaFX supports Hi-DPI displays.

UI Controls

The following lists some built-in JavaFX UI controls available in the JavaFX API.

  • Label
  • Button
  • Radio Button
  • Toggle Button
  • Checkbox
  • Choice Box
  • Text Field
  • Password Field
  • Scroll Bar
  • Scroll Pane
  • List View
  • Table View
  • Tree View
  • Tree Table View
  • Combo Box
  • Separator
  • Slider
  • Progress Bar
  • Progress Indicator
  • Hyperlink
  • Tooltip
  • HTML Editor
  • Titled Pane
  • Accordion
  • Menu
  • Color Picker
  • Date Picker
  • Pagination Control
  • File Chooser

JavaFX allows UI control nodes and shape nodes to coexist on the scene graph.

We can treat any UI control like any other JavaFX node, for example we can scale, rotate, style, and add effects.