Exercise 5: Java Applet - Simple

For a detailed Java information see The Java Tutorial.

W rite a java applet that will notifiy you when the applet has reached a major event in it's life cycle.

  1. First move into your web directory.
        $ cd www
    
  2. Create a directory called 'ex5' or 'exercise5' and move into it.
        $ mkdir ex5
        $ mv ex5
    
  3. Create a file called Simple.java and type in the program given in class.
        $ vi Simple.java
    
  4. Compile the source file.
        $ javac Simple.java
    
  5. Create the HTML file needed to display the applet.
        $ vi Simple.html
    
    Simple.html will look like the following:
    <HTML>
    <HEAD>
    <TITLE>The Life Cycle Applet</TITLE>
    </HEAD>
    <BODY>
    <APPLET CODE="Simple.class" WIDTH=150 HEIGHT=25>
    </APPLET>
    </BODY>
    </HTML>
    
  6. To check your results open the Simple.html file in your browser.
This is due in class on Monday. It needs to be turned into your www directory in a seperate directory named ex5 or exercise5.

Source code for Simple.java
A working copy of this applet