Java Reference
In-Depth Information
Figure 8-21. Making a GUI object scrollable using a JScrollPane
Bringing Denny's DVDs Together
Now it is time to bring the Denny's DVDs application together. The best way to launch the
Denny's DVDs client is through the use of a shell class. The entire responsibility of this class is
to initiate the launch of the application. Usually, an application shell will initialize some global
settings, such as the application's look and feel, and resolve any preconditions that must exist
for the application.
For the DVD client application, the main precondition is setting up the look and feel. In
order to provide users with a look and feel they are familiar with, we have chosen to set the
look and feel based on the system look and feel.
We also check the command-line options provided, as the command-line options set the
mode for the application.
Application Startup Class
The ApplicationRunner class is essentially an application loader. The only thing the main
method creates is an object of type ApplicationRunner . The ApplicationRunner class's con-
structor sets up the application's look and feel and instantiates either the MainWindow or the
ServerWindow class, as shown in Listing 8-19.
Listing 8-19. Denny's DVDs Main Application Loader
public ApplicationRunner(String[] args) {
if (args.length == 0 || "alone".equalsIgnoreCase(args[0])) {
// Create an instance of the main application window
new MainWindow(args);
} else if ("server".equalsIgnoreCase(args[0])) {
new ServerWindow();
} else {
Search WWH ::




Custom Search