Step 1

Step 1 creates several user interface components and adds them to the applet's inherent panel. Components include a TextArea and a Button.

Use of these components is illustrated in the applet that follows.

Example Applet

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

public class step1 extends Applet{

// adds UI components

TextArea ta = new TextArea ("My Text Area", 5, 40);
Button button = new Button ("Button");

  public void init ( ){
    setBackground (Color.white);
    setForeground (Color.red);
    add (ta);
    add (button);
  } // end init

}// end step1

Run the applet

Discussion

As can be seen in the class hierarchy, most UI components are subclasses of Component; their declaration is straight-forward. They are added to the applet's inherent panel through the add method, which is included in the Container class. Thus, messages propagate up the hierarchy from the applet to Panel to Container.

Question: in what class are the two methods that set colors found?