next up previous
Next: Draw a target Up: Assignment 5: Moiré patterns Previous: Assignment 5: Moiré patterns

Setup

1.
Use the Roaster wizard to create a new project named Moire.$\pi$, and a new Applet class named Moire. Make the window size 400 x 400. Make sure that you put the new project in a folder by itself, preferably on the desktop. Also, once you have chosen a name for the project and the class, stick with it. Many of you have discovered that it is difficult to put a project back together if its files are scattered or if you try to change the names of things.
2.
Write a method called paintCircle with the following prototype:

public void paintCircle (Graphics g, int diameter, int width, int height)

width and height are the width and height of the screen, as determined (in paint) by invoking bounds. paintCircle should draw a circle with the given diameter, in the center of the screen.

3.
Test your program by invoking it several times from paint, with various diameters.



Allen B. Downey
3/3/1998