I have a main class that calls a GUI so that users can enter in data. After the user is done and closes the GUI I need to preform other tasks but only after the GUI is closed. I keep seeing people have some of the same problem and be recommended to use a WindowListener and wait for windowClosing but that seems to be just for inside the GUI itself and I can't find any examples for how the my main class would be able to react to it. I tried approaching it as an actionListener but I wasn't able to find anything that would tell the calling thread. Am I missing something and if so what?
Here is the gist of what I have so far:
EditData (The GUI):
public class EditData extends JFrame implements ActionListener,
WindowListener
{
public void windowClosing(WindowEvent e)
{
}
}
MAIN:
public class main
{
public static void main(String[] args)
{
//Launches my GUI
java.awt.EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
EditData newEvent = new EditData(ID, conn);
}
});
//After the user closes newEvent, I need to do something
}