New Window Doesn't Load
===

I need some help, I have a method which is performed when a button is clicked, this method then opens a new window that updates a variable in another class, the method then gets this variable from the class and then uses it. 

The window that is loaded is blank, and it seems as if the wait() function is causing the thread to cease before the new window is loaded.

    private void autoFillUsersActionPerformed(java.awt.event.ActionEvent evt) {                                              
        publicLesson pL= new publicLesson();
        new dateSelect().setVisible(true);
        try{
            synchronized(this){
                this.wait();
            }
        }
        catch(Exception e){
            
        }
      int var= pL.getAmount();
      System.out.println("var ="+var);

        DefaultTableModel defaultModel = (DefaultTableModel) pupilTable.getModel();
        for (int i = 0; i <= (userCountAmount - 1); i++) {
            defaultModel.setValueAt(var, 5, i);
            System.out.println("BeingSet");
        }
        
    }  