Introduction to JavaFx With Scene Builder


Welcome to Tutorial base here we shall be showing you how to install javafx scene builder and configuring it with netbeans’ JavaFx applications.

Starting with netbeans java application

You need to start up netbeans so as to run javafx application. The steps below is need;

  • First of all, click on new projects so as to create new project
  • Secondly, click on Java Fx so as to select fxml application. It is a standard IDE fxml project.


After selecting fxml application click next

  • Change the project name to FXMLJavaApp


Click on finish

Your application is ready. Hence, you may wonder. What is the purpose of this tutorial? Yes, the purpose of this tutorial is to educate the proper way in which you can start building on your Java Fx application. If you’ve made it to this point congratulation! You are almost half way close to the end of this tutorial.

Important Things to Understand About The Basic Structure of a JavaFX Application

The main class of a Java FX application extends the javafx.application.Application class. The start() call is the main entry point for all Java FX applications. A JavaFX application defines the graphical user interface container by means of two classes; a stage and a scene.

The Java FX Stage class is the high-level Java FX container. The Java FX Scene class is the container for holding all contents. When we say scene builder App, what that means is the use of App to create JavaFx Scene Interface. In Java FX, the content of the scene is in the form of a hierarchical scene graph of nodes. In this tutorial, the root node is a StackPane object, which is a resizable layout node.

This means that the root node’s size defines the size of the scene. It tracks the scene’s size and changes when the stage is resized by a user. The main() method is not actually required for JavaFX applications. When the JAR file for the application is initiated with the JavaFX Packager tool, this embeds the JavaFX Launcher in the JAR file.

Nevertheless, it is very useful to include the main() method so that you can run JAR files that were created without the JavaFX Launcher, such as when using an Integrated Development Kit in which the JavaFX tools are not fully integrated. For example, Swing applications embed JavaFX code so therefore, it require the main() method.

Loading fxml file

Edit the line of code under the source packages named FXMLLoader pass the FXML file in the getResource() method.

Starting Scene Builder from NetBeans IDE

As soon as you right-click the node for the FXML file and choose Open, the NetBeans IDE will automatically locates the latest installed Scene Builder on your system and the Scene Builder will immediately appear on top of the Netbeans IDE.


To edit the FXML file in NetBeans FXML editor, from the File menu, kindly right-click the file’s node and choose Edit. The FXML source file contents are shown in the IDE’s source editor window. Build the application to your specifications.


Running Applications

Navigate to the file menu and right-click the source package and choose run.


Facebook Comments

5 thoughts on “Introduction to JavaFx With Scene Builder

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.