I dont know what is happening, Im trying to go back to the previous windows with some values already defined, but it doesnt work, I created an static ObservableList, so each time I add a new objective it will be added it, this part works, heres the code:
public void AddList(ActionEvent e) throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("Form.fxml"));
    Parent root = loader.load();
    Formcontroller = loader.getController();
    Scene scene = new Scene(root);
    Stage Newstage = (Stage)((Node)e.getSource()).getScene().getWindow();
    Newstage.setScene(scene);
    Newstage.show();
}
it will send me to the window where the form is, heres the code to add a new objective:
public void addObjective(ActionEvent e) throws IOException {
    if (this.saving.getText().equalsIgnoreCase("")) {
        Objectives object = new Objectives (this.objective.getText(), Double.parseDouble(this.price.getText()), 0);
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("Objectives.fxml"));
        Parent root = loader.load();
        Objectivescontroller = loader.getController();
        controller.AgregarObjetivo(object);
        Scene scene = new Scene(root);
        Stage Pstage = (Stage) button.getScene().getWindow();
        Pstage.setScene(scene);
        Pstage.show();
    }else {
        if (Double.parseDouble(this.saving.getText()) != 0 || Double.parseDouble(this.saving.getText()) == 0) {
            Objectives object = new Objectives (this.objective.getText(), Double.parseDouble(this.price.getText()), Double.parseDouble(this.saving.getText()));
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(getClass().getResource("Objectives.fxml"));
            Parent root = loader.load();
            Objectivescontroller = loader.getController();
            controller.addObjetive(object);
            Scene scene = new Scene(root);
            Stage Pstage = (Stage) button.getScene().getWindow();
            Pstage.setScene(scene);
            Pstage.show();
        }
    }
}
here is the code to add the objective to the list:
 public void addObjective (Objectives objective) {
    objectives.add(objective);
    listview.getItems().addAll(objectives);
}
each new objectives that I add it will stay in the list, the problem now its that Im trying to make a button in the form window, where I can click on it and go back without adding a new objective, but it shows me the list empty, i dont know why it doesnt show me the list that is already with objectives, heres the code:
public void goback (ActionEvent e) throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("Objectives.fxml"));
    Parent root = loader.load();
    Scene scene = new Scene(root);
    Stage Pstage = (Stage) button.getScene().getWindow();
    Pstage.setScene(scene);
}
its the same code that I used to add new objective, the only difference its that Im not calling the controller, sorry if my code is ugly or noob, but Im new in java - javafx and im just starting, thanks!
