0

I just started workin with javafx. I got my GUI done by Scene Builder with the first line here:

<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="645.0" xmlns="http://javafx.com/javafx/8.0.112-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sopraFx.extended.controller.SimpleController">

So I set the Controller. It gives me Stackoverflowexpection in line 26 which is the one saying:

"scene = loader.load();"

    public SimpleController(){
//      this.scene = new SimpleScene();
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("../view/SimpleScene.fxml"));
        try {
            scene = loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }
        view = loader.getController();

        initialize();
    }

This one is the Constructor of my Controller.

Would really appreciate your help! Thank you!

Stacktrace: http://pastebin.com/t9z2GHYs

Panikx
  • 45
  • 9
  • Can you post the entire stacktrace please? – Hypnic Jerk Feb 07 '17 at 22:27
  • this is the whole stacktrace: http://pastebin.com/t9z2GHYs – Panikx Feb 07 '17 at 22:30
  • What are you trying to accomplish here? Calling a new `SimpleController()` and loading the scene? – Hypnic Jerk Feb 07 '17 at 22:31
  • Please post stack trace in the question, not everybody reads comments. – Dominik Kunicki Feb 07 '17 at 22:31
  • @MichaelPickett yes, I want to load the scene in SimpleController() – Panikx Feb 07 '17 at 22:35
  • You should read this question for more info about why you are getting an overflow error http://stackoverflow.com/questions/34785417/javafx-fxml-controller-constructor-vs-initialize-method – Hypnic Jerk Feb 07 '17 at 22:36
  • I dont really see where this causes my Problem Michael Picket – Panikx Feb 07 '17 at 23:02
  • The `fx:controller` attribute is an instruction to the `FXMLLoader` to create an instance of the specified class. In your case, the constructor for that class loads the FXML file, which causes the `FXMLLoader` to create an instance of the class... – James_D Feb 07 '17 at 23:14
  • so, I dont really get what to do now. the loader.load(); is the problem here but what should I do to fix it? – Panikx Feb 08 '17 at 13:15

0 Answers0