Chapter 2 (Free web space) Introduction to Java Applications 67 menu
Chapter 2 Introduction to Java Applications 67 menu menu barbutton text field Fig. 2.7A sample Netscape Navigator window with GUI components. Fig. In method mainof Fig. 2.6, lines 12 13, JOptionPane.showMessageDialog( null, “WelcomentonJavanProgramming!” ); indicate a call to method showMessageDialog of class JOptionPane. The method requires two arguments. When a method requires multiple arguments, the arguments are separated with commas (,). Until we discuss JOptionPanein detail in Chapter 13, the first argument will always be the keyword null. The second argument is the string to display. The first argument helps the Java application determine where to position the dialog box. When the first argument is null, the dialog box appears in the center of the computer screen. Most applications you use on your computer execute in their own window (e.g., email programs, Web browsers and word processors). When such an application displays a dialog box, it normally appears in the center of the application window, which is not necessarily the center of the screen. Later in this book, you will see more elaborate applications in which the first argument to method showMessageDialogwill cause the dialog box to appear in the center of the application window, rather than the center of the screen. Good Programming Practice 2.11 Place a space after each comma (,) in an argument list, to make programs more readable. Method JOptionPane.showMessageDialogis a special method of class JOptionPanecalled a staticmethod. Such methods are always called by using their class name followed by a dot operator (.) and the method name, as in ClassName.methodName( arguments ) Many of the predefined methods we introduce early in this book are staticmethods. We ask you to mimic this syntax for calling staticmethods until we discuss them in detail in Chapter 8, Object-Based Programming. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision shared web hosting services