Java Reference
In-Depth Information
log.info("Invalid parameter passed in startup: " + args[0]);
// Logging may be turned off, or may be going to a file, so
// send usage information to the error output (usually the screen).
System.err.println("Command line options may be one of:");
System.err.println("\"server\" - the server application will start");
System.err.println("\"alone\" - client start in non networked mode");
System.err.println("\"\" - (no command line option): " +
"networked client will start");
}
}
The
ApplicationRunner
class also contains the static method
handleException
. The
method takes in a
String
argument and prompts the user with an error message box contain-
ing the string message. This method exists for the sole purpose of presenting application error
feedback to the user. All exceptions that occur in the
MainWindow
class will be caught, and dur-
ing the try/catch process a call to the
handleException
method will be made that will display
error information for the user.
The Client GUI
The bulk of the GUI logic is contained within the
MainWindow
class, which we will present here.
GUI Design and Layout
As mentioned in Chapter 2 and at the start of this chapter, we recommend you start by hand-
sketching your GUI. To give an example of what we mean, consider the sketch of the GUI we
will be developing for our client application that is shown in Figure 8-22.
Figure 8-22.
A hand-drawn sketch of the client GUI interface