JavaFX Alert dialog example

Quite often when building desktop applications there is a need to present information to the user.  A popular means of doing this is through the use of a popup dialog box.  JavaFX provides us with a few ways of doing this using the Alert dialog box.  In this tutorial we take a look at the various types of alert from error to confirmation.  

Below is a playlist showing a series of mini videos and in each video, we look at how to achieve a common programming need that may suit a dialog box.

The first video shows our sample application we will use throughout to demonstrate our examples.  This first example informs the user that the input fields failed validation.

The second video looks at the code used for the first video and how present the JavaFX Alert dialog box.

The third video extends the application to include a warning dialog box, presented whenever the user clicks the button to clear all fields.  This uses a warning tye dialog box and adds a button to allow the user to cancel the action if required.

The fourth video replaces the warning dialog box with a confirmation dialog box which by default provides a cancel button.   However in this video the default question mark logo image used by the dialog box is replaced with a warning triangle.

You can download the source code used in this playlist but you will need to provide an email address.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.