This tip shows the way to add window listener to a Frame. This listener is used when certain operations need to be done at different life cycle points of the window. For example if you want to save the data or you want to free the resource before closing of the window. This you can do in the windowClosed() method.