Home Segments Top Top Previous Next

688: Mainline

Once you have defined a window listener, with an appropriate listener method, and have connected a window-listener instance to a particular window, your application's window-displaying frame is ready to handle mouse clicks on the window-closing button. Whenever there is such a click, Java activates machinery, defined by the programmers that implemented the JFrame class, that does the following:

Then, the windowClosing method—defined in the instance's class—does its intended work, shutting down the application by calling the exit method.