// Customize the size of the frame
frame.setSize(200, 200);

import java.awt.event.*;

// Add a window listener to the frame
frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
        System.exit(0);
    }
});
