What is JavaFX?

JavaFX is a set of software APIs and tools that delivers desktop applications and rich internet applications (RIAs) that can run most anywhere Java runs. JavaFX applications run on Windows, MacOS, iOS, Android, Linux, and many other operating systems. JavaFX replaces Swing and the older AWT as Java SE’s GUI. Oracle is actively improving JavaFX, and likely will for many years to come.

That’s the simple version of what JavaFX is, but not a complete one. After reading the definition of JavaFX, you might still find yourself scratching your head and asking, What is JavaFX?

Obviously, this whole site is dedicated to answering that one question.

Continue reading “What is JavaFX?”

Bare Bones JavaFX “Hello World!”

JavaFX is a Java toolkit for creating visually pleasing apps. Java is a computer programming language that is used to write apps for most any Operating System (OS) that you can think of. That includes Windows, MacOS, iOS, Android, Red Hat, Solaris, AIX, FreeBSD, and many others that exist in the wild. JavaFX handles the windows, buttons, pictures, and graphics for those Java apps.

Never written a JavaFX or even a Java program before? Then, this is a good first app. All it does is create a window that shows the message, “Hello World!”

Continue reading “Bare Bones JavaFX “Hello World!””

Drawing Squares and Circles in JavaFX in Pure Java

I already gave an example of how to draw Squares and Circles on an FXML-generatated UI. Sometimes, you want to work without taking the time to create an FXML document. So this example delves into doing the same thing without using FXML.

Just drawing squares isn’t extremely exciting, because, … let’s face it, … the only time you want a window with one square and one circle in it, is when you are implementing the Candy Land board game.

Classic Candy Land Board Game
The only time you need just a circle and a square in a window, is when you are implementing a Candy Land game.
By Source (WP:NFCC#4), Fair use, https://en.wikipedia.org/w/index.php?curid=46225642

Continue reading “Drawing Squares and Circles in JavaFX in Pure Java”

JavaFX File Chooser

The newest version of the JavaFX FileChooser uses native FileChoosers to allow the selection of files. This means that the FileChooser is guaranteed to pass Apple Store requirements on having the OS and not the app control file system operations. However, it also means that the look and feel of your app may clash with the look and feel of the JavaFX file chooser, thus providing a degraded user experience. Most would say that is a fair trade off, as customers will already be used to their OS’s file chooser, and custom a JavaFX file chooser might hurt the user experience.

This short JavaFX tutorial goes into the three most common FileChooser uses. They are:

  1. Choosing one file to open
  2. Choosing multiple files to open
  3. Saving to a file

We’ll go into all three uses with examples.

Continue reading “JavaFX File Chooser”