Source of WelcomeApplet.java


  1: // Fig. 20.6: WelcomeApplet.java
  2: // A first applet in Java.
  3: import java.awt.Graphics;   // program uses class Graphics
  4: import javax.swing.JApplet; // program uses class JApplet
  5: 
  6: public class WelcomeApplet extends JApplet   
  7: {
  8:    // draw text on applet's background
  9:    public void paint( Graphics g )
 10:    {
 11:       // call superclass version of method paint
 12:       super.paint( g );
 13: 
 14:       // draw a String at x-coordinate 25 and y-coordinate 25
 15:       g.drawString( "Welcome to Java Programming!", 25, 25 );
 16:    } // end method paint
 17: } // end class WelcomeApplet
 18: 
 19: /**************************************************************************
 20:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 21:  * Pearson Education, Inc. All Rights Reserved.                           *
 22:  *                                                                        *
 23:  * DISCLAIMER: The authors and publisher of this book have used their     *
 24:  * best efforts in preparing the book. These efforts include the          *
 25:  * development, research, and testing of the theories and programs        *
 26:  * to determine their effectiveness. The authors and publisher make       *
 27:  * no warranty of any kind, expressed or implied, with regard to these    *
 28:  * programs or to the documentation contained in these books. The authors *
 29:  * and publisher shall not be liable in any event for incidental or       *
 30:  * consequential damages in connection with, or arising out of, the       *
 31:  * furnishing, performance, or use of these programs.                     *
 32:  *************************************************************************/