Computer Science 252
 Problem Solving with Java
Fall 2015, The College of Saint Rose
DiagonalOvals Demo
A working demo of DiagonalOvals will appear below. Click inside the applet to interact with it.
DiagonalOvals BlueJ Project
Click here to download a BlueJ project for DiagonalOvals.
DiagonalOvals Source Code
The Java source code for DiagonalOvals is below. Click on a file name to download it.
/**
 * Let's make some ovals in a nice pattern diagonally
 * 
 * @author Jim Teresco 
 * 
 * The College of Saint Rose, CSC 252, Spring 2014
 * 
 * $Id: DiagonalOvals.java 2319 2014-02-07 01:24:52Z terescoj $
 */
import objectdraw.*;
import java.awt.*;
public class DiagonalOvals extends WindowController
{
    private static final int SIZE = 40;
    
    public void begin() 
    {
        // nothing stops us from creating graphical objects in a loop
        int nextPos = 0;
        while (nextPos < canvas.getWidth()) {
            new FramedOval(nextPos, nextPos, SIZE, SIZE, canvas);
            nextPos += SIZE;
        }
    }
}