Scene Builder and <fx:root>

Greg Brown greg.x.brown at
Thu Jul 12 09:10:30 PDT 2012

> today I tested the setRoot method on FXMLLoader, introduced with 2.2. After some trial and error (the docs do not seem to be updated)

The docs were updated fairly recently. If they haven't made it into the latest beta, they should definitely be there for the final release.

> However, I am wondering how this is intended to integrate with Scene Builder. Maybe as follows?
> 1. Create some FXML in scene builder.
> 2. Load in IDE and manually wrap root element (e.g. BorderPane) into a new <fx:root> element with namespace and type attribute.

I'm not sure what level of support SB offers for fx:root right now, but the idea is that you would use it as follows:

<fx:root fx:type="javafx.scene.layout.BorderPane">

The fx:type attribute tells SB what type of element to expect. Later, when you load the document using FXMLLoader, you'll provide a concrete subclass of the specified type.


More information about the openjfx-dev mailing list