In this lab you will create three classes:
FaceViewer
FaceComponent
Face
FaceViewer creates a JFrame that contains a FaceComponent.
FaceComponent creates and draws two Face objects.
Here's a screen shot of the result:
A Face has four fields indicating the upper-left corner of the head as well as the height and width of the head. It also has a draw method:
class Face {
private int xLeft, yTop, height, width;
private String caption;
public void draw(Graphics2D g) {
// ???
}
}
Inside the draw method you need to do the following:
1. Compute the tops of the eyes, nose, and mouth
2. Compute the width of the eyes, nose, and mouth
3. Compute the height of the eyes, nose, and mouth
4. Compute the left edges of the left eye, right eye, nose, and mouth, and caption
5. Compute the bottom of the caption
6. Draw the head, eyes, nose, mouth, and caption.
You can add color on your second iteration.