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

蓝咒 提交于 2019-12-01 02:55:56

问题


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>

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:


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.




回答2:


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


来源:https://stackoverflow.com/questions/19972735/javafx-scenebuilder-2-0-doesnt-open-fxml-for-custom-components-with-fxroot-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!