/* User clicked on the X close-window button
* This method is the actionListener for the "windowClosing" event for the
* JFrame.
* To Create the ActionListener for the JFrame:
* Design view > Inspector panel
* Right-click on the JFrame, select Properties
* 1. Set "defaultCloseOperation" to DO_NOTHING
* 2. Click on Events. Scroll down to the "windowClosing" event.
* Click on the down-arrow button to the right of <none>.
* Press the Close button.
* The actionListener method will be inserted into your code.
*/
private void formWindowClosing
(java.
awt.
event.
WindowEvent evt
) { shutdownApplication();
}
/* Called by the actionListeners for File > Exit, and the
* red X close-window button.
*/
private void shutdownApplication() {
// Ask user if they really want to exit
"Are you sure you want to exit?", "Confirm Exit",
// Check user response
}
}