JavaFX:无效的属性错误

时间:2012-09-19 10:30:23

标签: java javafx javafx-2 fxml

我正在使用JavaFX 2.2编写应用程序。目前我在Main.fxml中收到错误。:

Invalid property.
file:/path/to/jar/myProject.jar!/myProject/Main.fxml:13

以下是Main.fxml的摘录:

<?import gui.main.elements.*?>
<MainPane fx:id="mainWindow" [...] xmlns:fx="http://javafx.com/fxml" fx:controller="myController">
  <children>
    <TextField fx:id="search" [...] promptText="Search..." /> 
    <TreeList fx:id="itemViewer" />
    <!--why does this not work!?-->
    <myTabPane fx:id="tabPane" />
  </children>
</MainPane>

TreeList extends TreeViewMainPane extends AnchorPanemyTabPane extends TabPane是自定义类。有趣的是,只需启用TreeList就可以正常运行,但每当我将TabPane更改为myTabPane时,我都会收到上述错误。它指向第13行,即<children>,这更令人困惑。我猜测myTabPane是MainPane的孩子有问题,虽然它适用于TreeList。

如果您需要我的更多代码,我将准备好为您发布。提前感谢您的回复。

1 个答案:

答案 0 :(得分:1)

发现错误。它比我想象的更愚蠢。 Main.fxml中的每个元素都应以大写字母开头!! (正如java惯例推荐的那样)所以我将myTabPane更改为TabManager,现在它可以工作了!