javajavafx-2fxmlborderpane

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


I am using BorderPane as a root pane of FXML file. However, the compiler complains that BorderPane has no controller property! How to bind a controller class to a FXML whose root is BorderPane?

<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.


Solution

  • Oops, it turns out that I used xmlns property of JavaFX 8 within JavaFX 2.2 environment. 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!