Scene Builder and <fx:root>
Daniel Fuchs
daniel.fuchs at oracle.com
Thu Jul 12 09:28:08 PDT 2012
> Subject: Re: Scene Builder and
> Date: Thu, 12 Jul 2012 12:10:30 -0400
> From: Greg Brown <greg.x.brown at oracle.com>
> To: Werner Lehmann <lehmann at media-interactive.de>
> CC: openjfx-dev at openjdk.java.net <openjfx-dev at openjdk.java.net>
>
Hi,
As Greg says - you will need to provide a value for the
fx:type attribute in fx:root - and you should be able
to load that in SceneBuilder.
SceneBuilder does not allow you to set fx:root from within
SceneBuilder itself (I mean, if you create an FXML from
within SceneBuilder it will not have the fx:root element) - but
if you load an FXML whose root element is fx:root then
SceneBuilder should be able to load it, and will preserve it.
Hope this helps,
-- daniel
>
>> 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">
> …
> </fx:root>
>
> 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.
>
> G
>
>
>
>
>
More information about the openjfx-dev
mailing list