SDSU CS 596 Java Programming
Fall Semester, 1998
Hello Applet
To Applet Index
San Diego State University -- This page last updated 16-Dec-98

Description

This applet draws hello world and draws a rectangle around its border

Applet

Your browser does not support Java applets, so you can not see this applet operate.

Applet Tag

<applet 
   archive="AppletClasses.jar" 
   code="HelloApplet.class" 
   width=200 height=200>
   Your browser does not support Java applets, so
   you can not see this applet operate.
</applet>

Applet Source Code

HelloApplet.java

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

public class HelloApplet extends Applet
  {
  public void init() 
    {
    repaint();
    }
  
  public void paint( Graphics display ) 
    {
    display.drawString( "Hello World!", 30, 30 );
    
    // Draw border
    Dimension size = getSize();
    display.drawRect( 0, 0, size.width-1, size.height-1);
    }
  }


Visitors since 16-Dec-98