i'm making a program that add events in a list but when i add event it doesn't update my list after closing addEvent Window , here is the senario :
1- this is the first window :
2- then i press the (+) button to add event in addEvent window :
here i add "test" item when i press ok to test my code
3- now i press "ok" button and return to the main window :
now nothing change in my list and it doesn't show that "test" item but this "item" already in the list and added successfully.
here is all the code :
- Main class
    public static void main(String[] args) {
        launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception{
        FXMLLoader loader = new FXMLLoader(getClass().getResource("main_layout.fxml"));
        Parent root = (Parent) loader.load();   
        primaryStage.setTitle("Goba To Do List");
        Scene scene = new Scene(root);
        primaryStage.setScene(scene);
        primaryStage.setResizable(false);
        primaryStage.show();
    }
- MainController class
    @FXML
    private ListView<String> LeftSideListId; // this names just for testing
    @FXML
    private ListView<String> RightSideListId; // this names just for testing
    @FXML
    private Button AddEvent;
    public void initialize() throws Exception {
        System.out.println("init");
        ObservableList<String>eventsNamesList=FXCollections.observableArrayList(
                "Daily Events","Custom Events","Completed Events");
        LeftSideListId.setItems(eventsNamesList);
        ObservableList<String>eventsList=FXCollections.observableArrayList(
                "item1","item2","item3");
        RightSideListId.setItems(eventsList);
        AddEvent.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent arg0) {
                AddButtonPressed();
                }   
        });
    }
    void AddButtonPressed() {
        addEventController.DisplayAddEventWindow();
    }
    public void DisplayAddEventWindow()
     {
         try {
             Stage primaryStage = new Stage();
             primaryStage.setTitle("Add Event");
             Scene scene = new Scene(AddEventScene);
             primaryStage.initModality(Modality.APPLICATION_MODAL);
             primaryStage.setScene(scene);
             primaryStage.setResizable(false);
             primaryStage.show();
         }
         catch(Exception e) 
         {
             e.printStackTrace();
         }
     }
    public void RefreshList() {
        System.out.println("refresh");
        RightSideListId.getItems().add("test");
        System.out.println(RightSideListId.getItems()); // here i get [item1,item2,item3,test]
    }
- AddEventController class
    @FXML
    private Button BtnOk;
    @FXML
    private Button BtnCancel;
    public void initialize() throws Exception {
         BtnOk.setOnAction(new EventHandler<ActionEvent>() {
             @Override
             public void handle(ActionEvent arg0) {
                 try {
                    BtnOkPressed();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
             }  
         });
         BtnCancel.setOnAction(new EventHandler<ActionEvent>() {
             @Override
             public void handle(ActionEvent arg0) {
                 BtnCancelPressed();
             }  
         });    
     }
     public void BtnCancelPressed() {
         Stage stg= (Stage)BtnCancel.getScene().getWindow();
         stg.close();
    }
    public void BtnOkPressed() throws Exception {
         Stage stg= (Stage)BtnOk.getScene().getWindow();
         stg.close();
         FXMLLoader loader = new FXMLLoader(getClass().getResource("main_layout.fxml"));
         Parent root = (Parent) loader.load();
         MainController mainController=loader.getController();
         mainController.RefreshList();
    }
so what i did wrong here ?
my list updates normally if i didn't open any windows so it is updating only while in the same window... idk why


 
    