JavaFX SceneBuilder 2.0 doesn't open FXML for custom components with fx:root as main layout tag


Question

I have custom component with layout on FXML file which containts line

<fx:root type="javafx.scene.layout.VBox" spacing="10.0" xmlns:fx="http://javafx.com/fxml">

I create this file on SceneBuilder 1.0, but then i try open this file on SceneBuilder 2.0 i got Exception

java.io.IOException: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load.
/Users/dmitrynelepov/Development/SogazGit/smpb/SMProjectBrownRelease/SMPBProxy/engine/fxml/component_daemon_viewer.fxml:14

Also must to tell: in applications this fxml loadings fine with setting root by code.

In official tutorial (http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm) tells:

<fx:root type="javafx.scene.layout.VBox" xmlns:fx="http://javafx.com/fxml">
    <TextField fx:id="textField"/>
    <Button text="Click Me" onAction="#doSomething"/>
</fx:root>

enter image description here

As u can see Oracle tells:Delete the AnchorPane markup that NetBeans IDE automatically generated.

But it's not working.

UPDATE

SceneBuilder 2.0 Build 7 - the problem persists

JDK8 b117 - the problem persists

Link JIRA: https://javafx-jira.kenai.com/browse/DTL-5968

1
6
11/26/2013 5:43:07 AM

Accepted Answer

Thanks for SceneBuilder developers.

Bug with https://javafx-jira.kenai.com/browse/DTL-5968 has fixed.

And on SceneBuilder 2.0 build 9 - problem was solved.

Question closed.

1
12/21/2013 6:52:30 PM

Not quite fixed for me. I am still getting this error.

java.io.IOException: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load. 
/C:/path-to-my-fxml/foo.fxml:11

at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:86)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:74)

With the latest version of Scenebuilder 2.0 dev release:

Build Information Version: 2.0-b09, Changeset: 12f988d79fe6 Date:
2013-12-19 09:33

Not sure what the workaround is at this point other than to keep on switching the fx:root for a concrete container object. Bummer.

  • chooks

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon