Reputation: 9353
When I do an fx:include in my fxml file, I got this error:
Caused by: java.lang.NullPointerException
at javafx.fxml.FXMLLoader.equals(FXMLLoader.java:1856)
at javafx.fxml.FXMLLoader.isCyclic(FXMLLoader.java:1868)
at javafx.fxml.FXMLLoader.access$2100(FXMLLoader.java:71)
at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:941)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:570)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2356)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2172)
Here is my root file:
<fx:root type="javafx.scene.layout.AnchorPane" fx:id="scrollPane" id="scrollStocksList"
xmlns:fx="http://javafx.com/fxml"
fx:controller="net.StocksListRunningController">
<fx:include fx:id="tableListStock"
source="/fxml/stocksList.fxml" />
</fx:root>
And my include file:
<fx:root type="javafx.scene.layout.VBox" xmlns:fx="http://javafx.com/fxml"
fx:controller="net.StockListTableController">
<TableView fx:id="stocksList" onMouseClicked="#openDetail">
<columns>
<TableColumn text="Titre" prefWidth="125">
<cellValueFactory>
<PropertyValueFactory property="title" />
</cellValueFactory>
</TableColumn>
</columns>
</TableView>
</fx:root>
If I remove my fx:include in my root file, all work fine.
I use the lastest version of java fx provided by jdk 7.0.51.
What is wrong in my include file (or other) ?
Thanks.
Upvotes: 1
Views: 586
Reputation: 9353
Here is the solution.
Add this line for the loader:
loader.setLocation(JfxUtils.class.getResource(fxml));
Very bad bug.
Upvotes: 1