<p>What is the proper way to terminate a Swing application from the code, and what are the pitfalls?</p>

<p>I'd tried to close my application automatically after a timer fires. But just calling <code>dispose()</code> on the <code>JFrame</code> didn't do the trick - the window vanished but the application did not terminate. However when closing the window with the close button, the application does terminate. What should I do?</p>

Try:
```
```
System.exit(0);
```
```
Crude, but effective.