NetBeans Scene Builder Integration: Fixing the Blank Canvas in JavaFX Projects
NetBeans' built-in Scene Builder button can save hours of hand-written FXML, but JDK 11+ projects often open a blank canvas. Here is how to configure the JavaFX module path and use the integration reliably.
05 Feb 2026, 12:57 UTC

Stop Hand-Coding FXML, but Fix the Canvas First
Hand-writing JavaFX FXML is verbose: every button, anchor pane, and spacing value is explicit, and a single misplaced attribute can leave your window looking nothing like the sketch in your head. NetBeans offers a Scene Builder toolbar button that promises to fix this, letting you drag components onto a visual canvas and save directly back to your FXML file. Under JDK 11 and later, however, that button often opens a blank canvas or throws missing-module errors. The useful takeaway is that the integration is not broken; it simply requires the JavaFX SDK to be visible to the designer process before you start dragging controls.
What the Integration Actually Provides
When the JavaFX plugin is active, NetBeans adds a Scene Builder toolbar button and a right-click Open → Scene Builder action for FXML files. Scene Builder is an external layout tool that the IDE launches for you, which means you do not need to configure a standalone installation path. Once open, the two tools stay synchronized: saving in Scene Builder writes changes back to the FXML source file that NetBeans has open. Depending on your project setup, the IDE can also generate or update a controller class skeleton so that your event handlers have a place to live.
FXML itself is an XML-based markup language that describes the JavaFX scene graph. Instead of instantiating a Button in Java code, you declare it in markup and let the FXMLLoader build the object tree at runtime. The Scene Builder integration exists to make that markup editable without typing every tag by hand.
Why JDK 11+ Projects Show a Blank Canvas
Before JDK 11, JavaFX shipped inside the JDK, so tools could find its classes automatically. Starting with JDK 11, JavaFX was decoupled from the JDK and distributed as a separate SDK with its own modules. Scene Builder needs those modules to render the canvas. If the JavaFX SDK modules are not on the project’s module path or classpath, the designer has nothing to draw with, and you get a blank window or missing-module errors instead of a layout.
This is a configuration problem, not a plugin defect. The IDE can launch Scene Builder, but it cannot invent the JavaFX runtime classes that the designer process needs. The same requirement applies whether you manage dependencies manually or through a build tool: the JavaFX artifacts must resolve before the preview will render.
Worked Example: From Plugin Check to FXML Sync
The following steps run entirely inside the NetBeans IDE. You need write access to the project directory and, for the first step, permission to activate plugins (which may require an IDE restart).
Step 1 — Confirm the JavaFX Plugin
In NetBeans, go to Tools → Plugins → Installed and look for the JavaFX plugin. If it is not listed or not active, install it from the Available Plugins tab and restart the IDE. Expected check: a Scene Builder button appears in the toolbar when an FXML file is selected.
Step 2 — Create a JavaFX FXML Project
Choose File → New Project → JavaFX → JavaFX with FXML. Replace <project-name> with your actual project name. Accept the default main class and FXML names unless your build requires otherwise. Expected check: the project compiles without “package javafx does not exist” errors.
Step 3 — Make the JavaFX SDK Visible
If you are using a non-modular project, add the JavaFX SDK lib directory to the project’s Libraries. If you are using a modular project, add the JavaFX SDK modules to the module path in Project Properties. For Maven or Gradle projects, ensure the JavaFX dependencies are declared and resolved. Expected check: the project builds, and the JavaFX classes are available to both the compiler and the runtime.
Step 4 — Open and Save from Scene Builder
In the Projects window, right-click the .fxml file and choose Open → Scene Builder. Drag a Button from the Controls palette onto the canvas, set its text, and save the file in Scene Builder. Expected check: the NetBeans editor tab for the FXML file shows a new <Button> element with the properties you configured.
Risk: if you have unsaved manual edits in the NetBeans FXML editor, saving from Scene Builder may overwrite them. Use version control or close the editor tab before opening Scene Builder.
Extending the Palette and the Runtime Gap
You can extend the Scene Builder palette with custom controls or third-party libraries by adding their JAR files to the project’s classpath and using the Reload Palette action in Scene Builder. Once reloaded, the new component appears in the palette and can be dragged onto the canvas.
The limitation is that the designer only needs the JAR to render the component at design time. At runtime, your application needs the same JAR plus any transitive dependencies it declares. A missing transitive JAR produces a ClassNotFoundException when the application starts, even though the designer displayed the component correctly. The canvas is a design-time view, not a runtime guarantee.
Actionable Closing
Before you rely on the live preview, run this three-point check: confirm the JavaFX plugin is active in Tools → Plugins → Installed; verify the JavaFX SDK modules are on the project’s module path or classpath; and save once from Scene Builder to confirm the FXML source updates. If the canvas is blank, stop designing and fix the SDK configuration first—every drag-and-drop after that is wasted effort. The integration is genuinely fast when the module path is correct, but it will never compensate for a missing JavaFX runtime.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.