/*
 * @(#)MyApplication.java  2.0  01 April 2005
 *
 * Copyright (c) 2003-2010 Werner Randelshofer
 * Hausmatt 10, Immensee, CH-6405, Switzerland.
 *
 * This software is in the public domain.
 * You are free to use, adapt, copy and license this work
 * without having to attribute to Werner Randelshofer.
 */

import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
/**
 * MyApplication.
 *
 * @author  Werner Randelshofer
 * @version 2.0  01 April 2005  Revised.
 */
public class MyApplication {
    /** Starts the application and returns when it is ready to use.
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    JFrame f = new JFrame("My Application");
                    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                    f.getContentPane().add(new JLabel("Hello World"));
                    f.pack();
                    f.show();
                }
            });
        } catch (InterruptedException e) {
            // Ignore: If this exception occurs, we return too early, which
            // makes the splash window go away too early.
            // Nothing to worry about. Maybe we should write a log message.
        } catch (InvocationTargetException e) {
            // Error: Startup has failed badly. 
            // We can not continue running our application.
            InternalError error = new InternalError();
            error.initCause(e);
            throw error;
        }
    }
}
