Basic Java Swing, como sair e descartar seu aplicativo / JFrame

Qual é uma boa maneira de descartar um JFrame com um código como este? Quero lidar com a saída da janela e a janela fechada.

Sei que não devemos usar System.exit ();

public class JavaCellularAutomataSquare {

  public static final String TITLE = "Cellular Automata - Squaring Example";

  private int maxWidth = 600;
  private int maxHeight = 600;

  public void launch() {    
    final JFrame frame = new JFrame(TITLE);   
    frame.setLocation(20, 20);    
    frame.setPreferredSize(new Dimension(maxWidth, maxHeight));
    frame.setResizable(false);
    frame.setFocusable(true);

    final JPanel panel = new JPanel();
    panel.setLocation(20, 20);
    panel.setVisible(true);
    panel.setPreferredSize(new Dimension(maxWidth, maxHeight));    
    panel.setFocusable(true);
    panel.setBackground(Color.white);

    // Panel setup, toggle visibility on frame
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);    
  }

}

questionAnswers(4)

yourAnswerToTheQuestion