Every time i add a controller to the fxml file, i get an exception: javafx.fxml.LoadException, and when i print the exception message it shows the right directory to the file
I am using netbeans 8 IDE, Java 8 and Scene builder for the GUI
FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Text?>
<AnchorPane id="AnchorPane" prefHeight="419.0" prefWidth="875.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="organizer.Controller.DeleteCategoryController">
<children>
<Pane layoutX="9.0" layoutY="108.0" prefHeight="283.0" prefWidth="550.0" style="-fx-border-width: 1pt; -fx-border-color: black;">
<children>
<Text fx:id="textDeleteThen" layoutX="195.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Delete ... category then" />
<Button layoutX="14.0" layoutY="166.0" mnemonicParsing="false" prefHeight="103.0" prefWidth="241.0" text="Option 3 Create a new Relationship and move contacts having ..... relationship to this relationship" />
<Button layoutX="266.0" layoutY="49.0" mnemonicParsing="false" prefHeight="103.0" prefWidth="241.0" text="Option 2 Keep all contacts with the .... relationship" />
</children></Pane>
<Pane layoutX="569.0" layoutY="19.0" prefHeight="372.0" prefWidth="272.0" style="-fx-border-width: 1pt; -fx-border-color: black;" />
<Text layoutX="41.0" layoutY="73.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Choose one of the following options" wrappingWidth="447.681640625" />
<Text fx:id="textDeletingCategory" layoutX="42.0" layoutY="24.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Deleting ..." />
<Text fx:id="textMessage" layoutX="42.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" text="After deleting .... do the following:" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="279.0" layoutY="271.0" mnemonicParsing="false" prefHeight="103.0" prefWidth="241.0" text="Option 4 Change Contacts having .... relationship to the following existing relationship" />
<Button layoutX="23.0" layoutY="153.0" mnemonicParsing="false" prefHeight="103.0" prefWidth="241.0" text="Option 1 Delete all contacts with the ..... relationship" />
<TextField layoutX="585.0" layoutY="56.0" prefHeight="25.0" prefWidth="184.0" />
<ListView fx:id="listViewRemainingCategories" layoutX="580.0" layoutY="138.0" prefHeight="236.0" prefWidth="241.0" />
<Text layoutX="580.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" text="List of other categories (for option 4)" />
<Text layoutX="585.0" layoutY="39.0" strokeType="OUTSIDE" strokeWidth="0.0" text="New Category Name (for option 3)" />
</children>
</AnchorPane>
And Controller:
package organizer.Controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.text.Text;
import organizer.Model.SQL_Objects;
public class DeleteCategoryController extends SQL_Objects implements Initializable{
@FXML private ListView listViewRemainingCategories;
@FXML private Text textDeletingCategory;
@FXML private Text textMessage;
@FXML private Text textDeleteThen;
private int toRemoveId;
private String toRemoveName;
private int associatedRecordsCount;
public DeleteCategoryController(String toRemoveName, int toRemoveId, int associatedRecordCount) {
this.toRemoveName = toRemoveName;
this.toRemoveId = toRemoveId;
this.associatedRecordsCount = associatedRecordCount;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
}
all other FXML files in my program work well, it is just this FXML file, and no matter which controller i add to it, it prevents it from loading, when i remove the controller attribute it opens normally.
Full stack trace:
javafx.fxml.LoadException:
file:/D:/Personal/Projects/Tools/Java/Organizer/dist/run798015614/Organizer.jar!/organizer/View/DeleteCategory.fxml:10
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:932)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at organizer.Controller.Main.switchWindow(Main.java:32)
at organizer.Controller.Main.start(Main.java:21)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InstantiationException: organizer.Controller.DeleteCategoryController
at java.lang.Class.newInstance(Class.java:427)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
... 23 more
Caused by: java.lang.NoSuchMethodException: organizer.Controller.DeleteCategoryController.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 25 more
Any idea why ? I appreciate your help