↓ Skip to main content
  1. JavaFX/
  2. The Absolute Beginners Guide to Reactive JavaFX/

Introducing the Absolute Beginners Guide to JavaFX

4 mins·
Table of Contents

Why?
#

Most of the tutorial articles I’ve written here have been of the “deep dive” nature. I try to go way beyond the information available in the JavaDocs, and to give some insight into how to get the most out of the tools that JavaFX provides. These articles tend to be on the long side, Jekyll tells me that they average about 13 minutes of reading, and there’s usually lots of code examples and pontification about clean coding and on and on.

I realize that these are going to be pretty advanced for someone who’s questions are about how to get that first screen up and running, or how to swap scenes with FXML.

I’ve also had the honour to help some students on Reddit with their assignments lately. While I’ve tried to be very careful about not doing their homework for them, I’ve tried to send them in the right direction to build good projects. I’ve been surprised at how many times I’ve been able to say, “Go and read this article that I wrote about this topic, it should tell you what you need to know”.

But, like I said, these tend to be more advanced articles with maybe more information than a student needs to read. I think it would be nice to have something aimed at people that don’t need the “deep dive” articles, just some basic information to get them started.

So I’ve been working for some time now on a series I’m calling, “The Absolute Beginners Guide to JavaFX”. It’s all about how to build Reactive applications in JavaFX. Even if you’re not a beginner, you may find it of interest.

You can find it here: https://www.pragmaticcoding.ca/beginners/intro

What’s in it?
#

This is a huge content drop for me, and it’s kept me busy for a long time. It’s also an ongoing project, so there’s more to come. So far, it’s divided up into two parts:

  • An introductory application.Pretty much “Hello World” in JavaFX. Then we add some user interaction and some styling. Just enough information to get a beginner started in the right direction.

  • A CRUD application.This is a step-by-step development of a basic Create-Retrieve-Update-Delete application for a customer database. The database is simulated as a simple Java class, and allows the whole application to work just like it would in real life.

At this point, I’ve completed the development of the CRUD application up to the point where it’s a completely functional “Create” application for account number and name. Complete means that it has validation in the GUI, background processing for the save function and handles exceptions from the database. It really is complete, just doesn’t have a lot of fields on the screen.

Programming Approach
#

First and foremost, this series is about writing Reactive JavaFX applications. So yes, we’ll be talking about HBoxes, and TextFields and Labels and all that good stuff, but the focus is on application architecture and Reactive programming techniques.

I should also point out that the content here, while primarily aimed at showing JavaFX concepts, is also aimed at showing good programming techniques, and how to constantly apply established principles to create clean code.

When will there be more?
#

I was concerned about finding the right time to publish the parts that have been completed. A series like this has to have enough content to be of use, but it’s pretty big, so you don’t want to wait until it’s all done before publishing it.

When you do publish, there’s an implied promise to supply more in a reasonable time frame. Because you don’t want to leave people hanging half way through a project. So I’m going to try to keep putting up more lessons on a regular basis.

As it is, it stops at a logic place, with the completion of the “Create” section, albeit with a limited number of fields and something less than a stellar look and feel. In the future, I’ll publish each part as soon as it is completed which will keep a steady stream of new content, but it might end with some “cliff-hangers” as it goes on.

What Will Be in the Next Lessons?
#

The next steps will be to add some more fields, work on some more sophisticated formatting for the GUI and then to add in the “Retrieve” function.

The Companion Project
#

There’s also a companion project on GitHub with all of the code for every single article. So you don’t have to do anything more than download the project to try things out for yourself.

I should also point out that the content here, while primarily aimed at showing JavaFX concepts, is also aimed at showing good programming techniques, and how to constantly apply established principles to create clean code.

Related

How To Build a Hex Map Based Application

16 mins
Introduction # Hex Maps, or hex boards are a popular platform for tabletop games, especially wargames and Role Playing Games. They are uniquely useful because hexagons fit nicely into a grid and there are 6 directions from each hexagon (or just, “hex”), compared to just 4 with a grid made up of squares.

Wordle in Kotlin JavaFX

16 mins
The original Wordle is JavaScript in a browser, here’s an implementation of it in Reactive JavaFX written in Kotlin.

Hangman in JavaFX

13 mins
How much code does it take to build a complete Hangman game in JavaFX? It turns out … Not much!

TextFields and TextFormatter - Part 1

8 mins
An introduction to TextFormatter, showing you how to integrate it into a TextField and how to use it to convert the input from String to some other kind of value. Then we’ll look at how to add a filter to prevent the user from entering invalid data.

TextFields and TextFormatter - Part 2

11 mins
A more in-depth look into how to build a TextFormatter that can be used to turn a TextField into sophisticated input field. We’ll look at designing a TextFormatter that is tailored to handle fixed place decimal input, using the decimal point itself as a control to toggle between the ordinal and mantissa of the number.

MineSweeper in JavaFX

19 mins
MineSweeper! Everyone’s favourite time-waster Windows game. Implemented in JavaFX showing how the reactive nature of JavaFX can be used with MVC to create a game.

How to Swap Scenes Properly

13 mins
Taking a look at the three most common design patterns for building systems with user interfaces. How are they different? which one is best? Is there anything better?