

The Absolute Beginners Guide to Reactive JavaFX
Table of Contents
A Short Introduction#
This is a guide to help you learn how to build JavaFX applications the right way. It’s not a reference guide, but an instructional guide intended to be read in order. Depending on your learning style, it’s probably a good idea to follow along with the guide in your IDE, trying out the examples and experimenting with some of the concepts along the way.
I’ve tried to keep each part short and easily digestible, so that you can stop at the end of any part and pick later from the next part.
My hope is that you fully understand the content of each part before moving on to the next. If you are confused about anything you can usually research in on the web, or find it in the JavaDocs for the components involved. If you are really stuck, you can send me an email and I’ll help. In any event, each part of this guide is written with the assumption that the content that preceded it has been fully understood.
What We’ll Build#
To start with, we’ll build a “throw-away” application to learn some basic concepts. This will start out as a simple “Hello World” application that we’ll add some styling and user interaction to. Then we’ll put it aside and build a real application, a “Create, Retrieve, Update and Delete” (CRUD) application for a simulated customer database.
JavaFX as a Reactive Framework#
This tutorial series concentrates on using JavaFX as a “Reactive” GUI framework.
What is a Reactive framework?
From WikiPedia:
In computing, reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change…
For example, in an imperative programming setting, a := b + c would mean that a is being assigned the result of b + c in the instant the expression is evaluated, and later, the values of b and c can be changed with no effect on the value of a. On the other hand, in reactive programming, the value of a is automatically updated whenever the values of b or c change, without the program having to explicitly re-execute the statement a := b + c to determine the presently assigned value of a.
Okay, but what does this get you?
In a word, simplicity.
Now your GUI is designed purely with the intent to reflect State at any given time in the best possible way. There is no code anywhere in your GUI that concerns itself with application logic or business rules or any of that.
At the other end, the business logic is concerned simply with maintaining and reacting to State without any idea of how it impacts the GUI.
It’s much easier to see it in practice than to describe it. In this series, we’ll start right from the beginning utilizing the tools and features in JavaFX that allow Reactive designs to be implemented. You’ll see that it’s not complicated, and a natural way to build an application with JavaFX.
Companion Project#
In order to make it easier to follow along at home, all of the source code from this series has been included in a companion project available on GitHub…
The source code is divided up into packages, each package containing the code as of the end the part of the series to which it corresponds. So the package ca.pragmaticcoding.beginners.part2 contains the code as described in part2 of this series.
In this way, you can see the whole application at each stage of its evolution, you can run it for yourself and see how it works. You can change code. You can break code. You can try your own ideas and experiment as much as you like.
On To It!#
Let’s get started!


Part 2 - Configuring Layouts

Part 3 - User Interaction

Part 4 - Styling

Part 5 - Application Framework

Part 6A - First Feature: Minimal Create

Part 6B - Adding Persistence

Part 7 - What Next?

Part 8 - Dealing With Latency and Blocking

Part 9 - GUI Validation

Part 10 - Handling Database Errors

Part 11 - A "Working" Application

Part 12 - Adding a New Field: eMail

Part 13 - Feature Envy

Moving On - Building A CRUD Application
Introduction#
So far we’ve built an application that does little, but demonstrates a lot. Now we’re going to write one of the most common types of application out there - CRUD (Create, Retrieve, Update and Delete).
