Adding Event Handling to Jframe dialog
<p>So I've got the following code to make a quick pop up box that informs my user that the program has finished running. I want to handle some extra events once the user clicks Ok, specifically I want to close up some drivers and an sql connection. How can I accomplish this? </p>

<p>Here's the code to that makes the jframe</p>

<pre><code>javax.swing.JFrame optionFrame = new javax.swing.JFrame();
     JOptionPane.showMessageDialog(optionFrame, "Tests Complete. Screenshots and Results can be found at C://Features");
     optionFrame.toFront();
     optionFrame.repaint();
     this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
</code></pre>