This ASCII file can be obtained from the following URL:

/wwwdb/htdocs/faculty/tohline/PHYS2411/q2.dir/Chap1.2.HelloWeb


             "Exploring Java" by Niemeyer & Peck

                 ----   Hello Web!   ----
                     Example on p. 30

To run each of the "Hello Web" java classes, use the following
html text:

---------------------------------------------------------------
NOTE:  Before compiling any one of the following examples, you
       MUST name the file containing your example code 
       "HelloWeb.java".  It's resulting (compiled) Java byte-code
       will then be called "HelloWeb.class".  
NOTE:  When running on the UNIX machine (baton or mleesun), don't
       forget to change the permission (using "chmod") on your
       "HelloWeb.class" file so that the above HTML file can
       actually run the applet from any web browser!
---------------------------------------------------------------


//Example #1.1.A:  Straight from the textbook.

public class HelloWeb extends java.applet.Applet {
   public void paint( java.awt.Graphics gc ) {
      gc.drawString("Hello Web!", 125, 95 );
   }
}

---------------------------------------------------------------

//Example #1.1.B:  Some shorthand.

import java.applet.*;
import java.awt.*;

public class HelloWeb extends Applet {
   public void paint( Graphics gc ) {
      gc.drawString("Hello Web!", 125, 95 );
/*  
    NOTE:  "drawString" is the "method" (or function) defined 
    within the "Graphics" class (which, itself is defined
    within the larger "java.awt" [Abstract Windowing Toolkit]
    class) that does ALL of the work for this "simple" applet.  
    What "drawString" actually does is hidden from us, but can 
    be found in online Java documentation.

    See, for example, pp. 253-254 of "Java in a Nutshell 
    (version 1.0)" which says:

    public abstract void drawString(String str, int x, int y);

*/
   }
}

---------------------------------------------------------------

//Example #1.1.C:  Some shorthand and Declaring Variables.

import java.applet.*;
import java.awt.*;

public class HelloWeb extends Applet {

// Here xPosition and "yPosition" are assigned default values of 0 (zero).
   int xPosition, yPosition;   
   String theMessage = "Hello Web!";

   public void paint( Graphics gc ) {
      xPosition = 125;
      yPosition = 95;
      gc.drawString( theMessage, xPosition, yPosition );
   }
}

---------------------------------------------------------------