Posts tagged javafx


JavaFX Update for JDK 8u40

JDK 8u40 was released. It includes some new JavaFX UI controls like Spinner, Formatted TextFields, and (finally) simple Dialogs. Tutorial Update I've updated the entire JavaFX 8 Tutorial for JDK8u40. This is what changed: Use the new Dialogs instead of the deprecated ControlsFX Dialogs (see this article about the official JavaFX Dialogs). Create...

Read more →


JavaFX vs. HTML5

Choosing a rich client technology is very difficult! I recently did some consulting for a company that needed to choose between JavaFX and HTML5. In this article I would like to share some of my insights on this topic. I don't intend this to be a battle between technologies by making...

Read more →


JavaFX Dialogs (official)

JavaFX 8u40 finally includes simple Dialogs and Alerts! I've been waiting for this since 2012! In the meantime I wrote about how to use Dialogs in JavaFX 2 and later in JavaFX 8 with ControlsFX. Now that they are available in the official JDK, let's learn how to use them. Prerequisites To use...

Read more →


JavaFX Tutorial in Spanish, Chinese and Portuguese

Wow, I'm really excited about the community contributions that were made to the tutorials! Some amazing people have helped improve the materials by writing valuable comments and some have even provided a translation for their language. Thank you very much, you're awesome!! ...

Read more →


Update to JavaFX 8 - What's New?

JavaFX 8 is included in JDK 8 and is the officially recommended graphics toolkit for Java 8 applications. I've been using JavaFX 2 since 2012 and am very pleased as it was already a major step forward compared to Swing. Now with JavaFX 8 it has become even better, with...

Read more →


JavaFX 8 Event Handling Examples

In most JavaFX applications we have to react to many user events: The user clicks a button, presses a key, moves the mouse, etc. This post describes how to handle some of the most common JavaFX events. Our Example Application Download Example Example Source Code FXML and Event Handling I like to keep the...

Read more →


JavaFX 8 TableView Cell Renderer

In this post I will show how to customize the rendering of a JavaFX TableView. This is an updated version of the JavaFX 2 TableView Cell Renderer article. Compared to the old version, we can now use some Java 8 language features like lambda expressions and the new Date and...

Read more →


JavaFX 8 TableView Sorting and Filtering

JavaFX 8 comes with two new classes, SortedList and FilteredList. In JavaFX 2 we had to manually do the filtering as I've described in an earlier post. So, let's see how we can use the new classes to sort and filter a TableView. Example Setup As an example we'll create a simple table...

Read more →


JavaFX 8 Date Picker

Finally, with JavaFX 8 a DatePicker control was added (for JavaFX 2 we had to create our own)! The DatePicker works well in combination with the new Java 8 Date and Time API. Those two things together provide a much better experience when working with dates in Java! Basic Usage Using the...

Read more →


JavaFX 8 Dialogs

Deprecated! Please read the → Article about the official JavaFX Dialogs! With JDK version 8u40, the Dialogs were finally included in the official JavaFX. This means that the ControlsFX Dialogs described in this post will be deprecated! ...

Read more →


JavaFX 2 Date Picker

→ For an UPDATED VERSION of this article go to: JavaFX 8 Date Picker As JavaFX 2.2 doesn't contain a Calendar control we would have to create our own to provide a convenient way to enter a date. Fortunately, Christian Schudt has created a very nice DatePicker that we...

Read more →


JavaFX 2 Snapshot as PNG Image

JavaFX 2.2 and above provides a convenient screenshot feature. It takes a snapshot of any node or scene. The following method saves the barChart node as a png image: @FXML public void saveAsPng() { WritableImage image = barChart.snapshot(new SnapshotParameters(), null); // TODO: probably use a file chooser...

Read more →


JavaFX 2 Scene Builder and e(fx)clipse Updates

I'm excited about the quick reaction to bug reports by the JavaFX developers at Oracle! I've reported an (annoying) Scene Builder bug at the end of November and it was already fixed in a new Scene Builder version in January. Scene Builder Update The Scene Builder bug forced us to delete and...

Read more →


JavaFX 2 Event Handlers and Change Listeners

→ UPDATED VERSION of this article available: JavaFX 8 Event Handling Examples Very often in JavaFX we have to react to user events: The user clicks a button, presses a key, moves the mouse, etc. This post describes how to handle such events. We'll try to do as much...

Read more →


JavaFX 2 TableView Cell Renderer

→ UPDATED VERSION of this article available at: JavaFX 8 TableView Cell Renderer In this post I will show how to customize the rendering of a JavaFX 2 TableView. The Birthday column in the screenshot below is a formatted Calendar object. Depending on the year, the text color is...

Read more →


JavaFX 2 TableView Filter

→ UPDATED VERSION of this article: JavaFX 8 TableView Sorting and Filtering The JavaFX 2 TableView lacks the ability for filtering. The intention before JavaFX 2.0 shipped was to include a FilteredList that would wrap an ObservableList (see Oracle forum Filter rows on TableView). Unfortunately, the filtering was removed...

Read more →


JavaFX 2 Dialogs

→ For an UPDATED VERSION of this article go to: JavaFX 8 Dialogs When programming a graphical user interface (GUI) there are occasions where you'll need a simple popup dialog to communicate with the user. In Swing (the predecessor of JavaFX) there is a convenient class called JOptionPane for...

Read more →


— Blog Archive —