WindowListener for closing JFrames and use global variable
I'm struggling with using WindowListener for closing JFrames. I have a situation where a client is logged on to a server and when the client closes his application the server needs to be informed. So in order to inform the server, another instance of a class (that handles the rmi implementation) should be addressed. that instance is a global variable in my GUI class. I searched the web a bit but all i can fined to the problem is the following structure addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent e) { System.out.println("jdialog window closed event received"); }