title: Catching Exceptions in Swing GUI application
body: <p>I have a GUI Swing app.</p>
  
  <p>Is there a way to catch all exceptions?</p>
  
  <p>I have a made a Database Class that holds my database JDBC objects.</p>
  
  <p>It is declared as a field in my Swing GUI Class.</p>
  
  <pre><code>e.g. 
  
  public class MySwingGUI {
  
    protected Database database = new Database();
  </code></pre>
  
  <p>so if any exceptions propagate up from somewhere in the GUI code, I want to somehow handle it so that I can close the database connection.</p>
  
  <p>any ideas?</p>