Your last look before creating a different Applet!

This document was written by CS 290W TA Joshua Kay and was last modified

Okay, Applet #3. This introduces a few new things, so hold on. 1 //One last superEasyApplet from squash 2 3 //importing neccessary packages 4 import java.awt.*; 5 import java.applet.*; 6 7 //the name of the public class is the name of the program 8 public class WelcomeAgainMan extends Applet 9 { 10 public void init() 11 { 12 this.add(new Label("WelcomeAgainMan!!!")); 13 } 14 } 15 16 //granted this one might be a little more confusing 17 //but I guarantee you'll find this simple in a week or so! :) Lines 4-5 - You already know these, importing needed packages.

Line 10 - Back to an Applet with public void init(). This is the standard.

Line 12 - this.add(new Label("WelcomeAgainMan!!!"));

Okay, the 'this' keyword is something you will run across a lot in Java. 'this' is the implicit argument sent to a method of any class, representing itself. In other words, in this case, 'this' represents the applet.

So this.add() means that we are adding something to 'this' or in this case, the applet.

new Label() we are creating a new label, and assigning the text "WelcomeAgainMan" to that Label

Label is another class of the java.awt.package, like Button, or TextField. You will get a lot of use with this. Don't worry.