问题描述
我在FXML文件上有自定义组件,其中包含行
< fx:root type =javafx.scene .layout.VBoxspacing =10.0xmlns:fx =http://javafx.com/fxml>
我在SceneBuilder 1.0上创建此文件,但后来我尝试在SceneBuilder 2.0上打开此文件我得到了异常
java.io.IOException:javafx.fxml.LoadException:尚未设置Root。在加载之前使用方法setRoot()。
/Users/dmitrynelepov/Development/SogazGit/smpb/SMProjectBrownRelease/SMPBProxy/engine/fxml/component_daemon_viewer.fxml:14
还必须告诉:在应用程序中,这个fxml加载很好,并且按代码设置root。
在官方教程中(
感谢SceneBuilder开发人员。
错误使用 https://javafx-jira.kenai.com/browse/DTL-5968已修复。
在SceneBuilder 2.0版本9上 - 问题已解决。
问题已关闭。
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
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.
这篇关于JavaFX SceneBuilder 2.0不会为fx:root作为主布局标记的自定义组件打开FXML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!