|
How to exit an application when a Frame is closed |
|
|
This Java tip illustrates a method of exiting an application when its frame is closed. In Java,
when the closed button is clicked there is no action defined by default. Generally developer would like
to end the application when the frame is closed.
// Application frame
Frame applicationframe = new Frame();
// Add a listener for the frame close event
applicationframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
// Exit the application
System.exit(0);
}
});
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.