CS 110 Introduction to Computing
Fall 2003

Project #2: Two Applets

Due in class on Wednesday, September 24, 2003


This project builds on the previous one in two ways. First you will use the Java applet you wrote for Project#1 and modify it into an applet that displays a standing or jumping stick figure in response to the pressing of two buttons in the interface. You will then write a second Java applet, from scratch, that draws a self-portrait in an area of 100x100 pixels using the graphics drawing facilities learned in Chapter 2 of your textbook.

Applet#1: Standing/Jumping Stick Figure

This applet, shown below, is to get you to understand the structure of the Smiley applet by trying a simple variation on it. Read the Smiley applet code carefully and then design the modifications that will convert it into the applet below. Do this by creating a copy of the Smiley applet in a new project. Make the changes one at a time, testing to ensure that they were successful each time before making the next change. Drawing the stick figures will utilize some of the basic graphics drawing facilities. Start by modifying the user interface components, and then move on to the drawing details. If possible, decompose your drawing commands into separate methods.



Applet#2: Self-protrait in 100x100 pixels

Using the graphics operations learned in class, design a graphical self-portrait (or drawing) of your own choosing. This exercise is designed to give you some practice with the drawing commands and at the same time provide you with an opportunity to explore the limits of these commands, as well as your own imagination. While this is an open ended exercise, do keep in mind the amount of time you can spend on it and at the same time at least make an attempt to go beyond a trivial design.

The self protrait should be drawn using a method whose name should be the same as your username. For example, in my program, I will name the method dkumar and use it as:

dkumar(g, x, y, w, h);

where g is the Graphics object, x and y are the coordinates of the top left corner and w and h are the width and height, repectively, which will be set to 100.

Use the Generic Applet template discussed in class (one that has init and paint methods only) for this exercise.

Remember to:

Post your applets in your own web page.

Notes for both exercises

  1. Do each exercise as a separate CodeWarrior project.
  2. Play close attention to the syntax. Every Java instruction has to be written with proper punctuations as well as with consistent use of upper/lower case character combinations.
  3. Make sure you enter your name in the NAME slot at the top of the program. Also, modify the SIGNATURE slot in the program,
  4. Once you are done with the exercise, hand in a printed (stapled) report that contains the following:

Back to:Course Materials