简体   繁体   English

类'javafx.scene.layout.BorderPane'不支持属性'controller'

[英]Class 'javafx.scene.layout.BorderPane' does not support property 'controller'

I am using BorderPane as a root pane of FXML file. 我使用BorderPane作为FXML文件的根窗格。 However, the compiler complains that BorderPane has no controller property! 但是,编译器抱怨BorderPane没有controller属性! How to bind a controller class to a FXML whose root is BorderPane ? 如何将控制器类绑定到以BorderPane根的FXML

<BorderPane id="rootPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.saei.explorer.FXMLDocumentController">

I am using BorderPane because of its capability of stretching the layout on re-sizing the window. 我正在使用BorderPane因为它能够在重新调整窗口大小时拉伸布局。

Oops, it turns out that I used xmlns property of JavaFX 8 within JavaFX 2.2 environment. 糟糕,事实证明,我在JavaFX 2.2环境中使用了JavaFX 8的xmlns属性。 I just replaced: 我刚换了:

xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"

with: 有:

xmlns:fx="http://javafx.com/fxml"

and it works now! 它现在有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM