When I run the following code in intellij with java 8 I get an error. Please Help. The fxml is generated using the scene builder, I think the button Dagrooster isn\'t linked
The error says it, the FXML is missing the fx:controller
declaration. Add the controller declaration to BorderPane
declaration as shown :
...
<BorderPane maxHeight="1.7976931348623157E308"
maxWidth="1.7976931348623157E308" prefHeight="400.0"
prefWidth="600.0" xmlns="http://javafx.com/javafx/8"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="Weert.Controller">
...
To know how to set controller class via SceneBuilder, you can have a look at this question.
As the error implies, problem is in "fxml", in which it is referring to class which do not exist. To solve this search an attribute called "fx:controller" and assign it qualified class name . For an instance "fx:controller="packagename.className".
It is true you havent told the fxml file where the controller class is...
this ...
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
As this...
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Weert.Controller">
Or even this...
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller">
.. then put both files in the same folder