javaswingjframejdialogjoptionpane

One JFrame don't stop other frame's code


When the user clicks on the edit button a new frame is shown to them, and when the new frame is closed i want the refresh line to execute but problem is, the refresh line is executed before closing the new frame...I am using NetBeans for making UI.

//If user clicks on edit button new frame will be shown to him 
EditUserFrame editUserFrame = new EditUserFrame();
Iterator itr = userList.iterator();
while(itr.hasNext()){
    user = (Users)itr.next();
    if((user.getF_name().equals(f_name) && user.getL_name().equals(l_name))){
        break;
    }
}//End of While Loop
editUserFrame.setUserObj(user);
editUserFrame.getExistingValues();
editUserFrame.setVisible(true);
//I want this line to be executed when the editUserFrame is closed..
RefreshUserTable();

I want new Frame like this is it possible to make form given in picture in JOPtionPane as suggested by you guys.

enter image description here


Solution

  • you can use the

    'editUserFrame.addWindowListener(new WindowAdapter()
    {
        public void windowClosed(WindowEvent e){
        //call your method from here
            RefreshUserTable();
        }
    };'
    

    hope this helps