how to close a window in awt program

Solutions on MaxInterview for how to close a window in awt program by the best coders in the world

showing results for - "how to close a window in awt program"
Elias
19 Mar 2019
1public class AdapterExample extends WindowAdapter{  
2    Frame f;  
3    AdapterExample(){  
4        f=new Frame();  
5        f.addWindowListener(this);  
6          
7        f.setSize(400,400);  
8        f.setLayout(null);  
9        f.setVisible(true);  
10    }  
11public void windowClosing(WindowEvent e) {  
12    f.dispose();  
13}  
14public static void main(String[] args) {  
15    new AdapterExample();  
16}