Swing Application Startup

The startup of an application is one of the based parts where a framework support is very helpful because especially with Java Swing. In Swing there is the Event Dispatch Thread (EDT) which executes any UI related stuff. So anything that is related to UI should be executed in this thread, even the creation of a frame. So how can  a framework support this procedure. One example comes with the Swing AppFramework where a launcher moves the creation and invocation of the startup method into the EDT but than also does a lot of application specific or sometimes unneeded stuff like I18n, session storage.

A really simple approach is shown in the following picture.

Application Startup

The user starts the application either using Web Start, clicking on the JAR or command line. In the applications main-method is one line Launcher.launch(Application.class, args) where the application class and command-line arguments are passed to the launcher. This one creates a new application instance and invokes the startup method in the EDT using SwingUtilities.

Because no window is shown any configured splash screen will be shown until the frame (or window) which is created in startup method is shown to the user. The behavior of startup is application specific but often it can be divided into an initialization part of the platform. Typical services like executor, communication layers, logging, modularization are initialized. After this is completed the application frame is created and shown to the user.

Schlagwörter: ,

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: