I want a temporary loading screen in the transition from one frame to another. In the mainframe I create the loading screen which creates the other screen (employmentframe). It only creates it, it does not show it yet.
In the employment frame I have put some loadingframe.setloadingbar() methods which call the setloadingbar method in loadingframe. This works perfect until it reaches 100. At getvalue() == 100 it should set the employmentframe visible, but instead it gives me a nullpointerexception. Which is weird because the employment-screen IS created. 
The code is below -
Employmentframe:
   public EmploymentFrame(int eid, JFrame thisframe) {         
        initComponents();
        //loadCaseFileList();
        e_id = eid;
        loadCourseList();
        EmploymentFrame.thisframe = thisframe;
        LoadingFrame.setLoadingBar(1);
    }
    public static void setEmploymentFrameVisible()
    {
       thisframe.setVisible(true);
    }
The loadingframe:
private static JFrame Employmentframe;
private static int oldvalue;
private int e_id;
public LoadingFrame(int type, int eid) {
    initComponents();
    this.e_id = eid;
    if(type == 1)
    {
        Employmentframe = new EmploymentFrame(eid, Employmentframe); 
    }
}
   public static void setLoadingBar(int load)
   {
       oldvalue = LoadingBar.getValue();
       System.out.println(""+oldvalue);
       int newvalue = oldvalue+load;
       System.out.println("nv"+newvalue);
       LoadingBar.setValue(newvalue);
       if(LoadingBar.getValue() == 100)
       {
           EmploymentFrame.setEmploymentFrameVisible();
       }
   }
Thanks.
 
     
    