Generate a UI Stub File for a JavaFX Graphic in the NetBeans IDE

The NetBeans IDE includes tools for working with JavaFX graphics. This topic shows how to create a UI stub file in the NetBeans IDE for JavaFX.

Overview

When a JavaFX Content File (FXZ) is included in a NetBeans project, developers can generate a UI Stub file, which enables them to easily access the graphical elements from JavaFX applications. This UI Stub file defines variables for all of the graphic objects with an ID value. The UI stub file that is generated has the same name as the JavaFX graphic plus a UI suffix. For example, if the JavaFX graphic is named mediaplayer.fxz, the stub file is named mediaplayerUI.fx. The class that is generated also has the name mediaplayerUI.

It is not necessary to generate a UI Stub file to use an FXZ graphic in a JavaFX application. For an example of an application that does not use a UI stub file, see the 15 Puzzle sample in the /Samples folder in the JavaFX Production Suite installation directory.

Prerequisites

  • The JavaFX Content File (FXZ) must be added to a NetBeans project.

Procedure

  1. In the NetBeans IDE, open the project for your JavaFX application.
  2. Locate the JavaFX Content File (FXZ) in the Projects window.
  3. Right-click (or Control-click on the Mac) the JavaFX Content File (FXZ) and select Generate UI stub.