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);
        }
    });