* Create and display the main window.
*/
private static void createAndShowGUI() {
try {
MainFrame frame = new MainFrame();
final ApplicationProperties appProps = new ApplicationProperties(
frame);
frame.setSize(appProps.getMainWdwWidth(), appProps
.getMainWdwHeight());
frame.setLocation(appProps.getMainWdwUpperLeftX(), appProps
.getMainWdwUpperLeftY());
frame.setVisible(true);
// We create a shutdown task rather than a window listener
// to store application properties, otherwise on the Mac, we
// would also have to trap the VStar (vs File) menu Quit item.
// This shutdown task should work uniformly across operating
// systems. The frame stored within appProps cannot be GC'd
// until appProps is, so its state will still be valid at the
// time run() is invoked.
Runnable shutdownTask = new Runnable() {
public void run() {
appProps.update();
}
};
Runtime.getRuntime().addShutdownHook(
new Thread(shutdownTask, "Application shutdown task"));