How to Build a JavaFX Desktop Application from Scratch

Hello! In this blog, Iā€™ll guide you through creating a JavaFX desktop application.

Before we get started on building the application, letā€™s first review the JavaFX architecture to understand how it functions behind the scenes.

6 Hours of debugging can save you 5 minutes of reading documentationšŸ˜.

JavaFX Architecture Diagram

  1. JavaFX Public APIs and Scene Graph:

    • JavaFX Public APIs: These are the classes and methods you use when writing JavaFX applications. They provide the tools for creating user interfaces, handling events, and managing different parts of your application.

    • Scene Graph: This is a hierarchical structure used to represent the UI of your JavaFX application. Think of it as a tree where each node is a visual element (like a button or a text field). The scene graph manages how these elements are displayed and interacted with.

  2. Quantum Toolkit:

    • This is the underlying framework that JavaFX uses to build and render its user interfaces. It handles the low-level details of rendering and managing the graphical components you see on the screen.
  3. Prism:

    • Prism is a component of the Quantum Toolkit that deals with rendering graphics. It is responsible for drawing shapes, images, and text. Prism can use different technologies like hardware acceleration to make rendering faster and more efficient.
  4. Glass Window Toolkit:

    • Glass is responsible for handling the windowing system. It deals with things like managing windows, handling input events (such as mouse clicks and keyboard presses), and interacting with the operating system's native windowing system.
  5. Media Engine:

    • This part of JavaFX handles media playback, such as playing audio and video files. It provides the tools necessary for integrating multimedia content into your application.
  6. Web Engine:

    • The Web Engine allows you to embed web content within your JavaFX application. It uses the WebKit rendering engine to display web pages and interact with web content.
  7. Java2D:

    • Java2D is a set of APIs for drawing 2D graphics in Java. Although JavaFX has its own graphics engine (Prism), Java2D might still be used in some contexts, especially if youā€™re working with legacy code or integrating with other Java graphics tools.
  8. OpenGL:

    • OpenGL is a graphics API that allows for rendering 2D and 3D graphics. JavaFX can use OpenGL for hardware acceleration to improve the performance of rendering complex scenes.
  9. D3D:

    • Direct3D (D3D) is a Microsoft API used for rendering 3D graphics on Windows platforms. Similar to OpenGL, D3D can be used by JavaFX for hardware-accelerated rendering.
  10. JDK API Libraries & Tools:

    • These are the standard libraries and tools provided by the Java Development Kit (JDK) that JavaFX uses. They include essential Java classes and utilities that support JavaFX functionality.
  11. Java Virtual Machine (JVM):

    • The JVM is the runtime environment that executes Java applications. It handles the execution of Java bytecode and provides the necessary resources for Java programs to run, including JavaFX applications.

Now let's start implementing our first JavaFX Desktop ApplicationšŸ˜Ž

...Inprogress

...Inprogress

...Inprogress

0
Subscribe to my newsletter

Read articles from Jomari Sarmiento Abejo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jomari Sarmiento Abejo
Jomari Sarmiento Abejo

Software Development Major | BSIT Student | Java Programmer | Eager to Build & Innovate