Computer Science 252
Problem Solving with Java

Fall 2013, The College of Saint Rose

Arcs Demo

A working demo of Arcs will appear below. Click inside the applet to interact with it.



Arcs BlueJ Project

Click here to download a BlueJ project for Arcs.


Arcs Source Code

The Java source code for Arcs is below. Click on a file name to download it.


Arcs.java

import objectdraw.*;
import java.awt.*;

/*
 * Example Arcs: using FilledArc and FramedArc objects
 *
 * Jim Teresco, Siena College, CSIS 120, Spring 2011
 * Updated, Spring 2012
 * The College of Saint Rose, Fall 2013
 *
 * $Id: Arcs.java 2218 2013-10-18 14:06:39Z terescoj $
 */

public class Arcs extends WindowController {

    public void begin() {

        // just draw a bunch of FilledArc and FramedArc objects to
        // get an idea how to use them.

        // a black one with a start angle of 30, arc angle of 90
        new FramedArc(50, 50, 100, 100, 30, 90, canvas);
        new Text("start angle 30, arc angle 90", 50, 30, canvas);

        // a red one with a start angle of -30, arc angle of 90
        new FramedArc(20, 100, 100, 100, -30, 90, canvas).setColor(Color.red);
        new Text("start angle -30, arc angle 90", 20, 80, canvas).setColor(Color.red);

        // a blue one with a start angle of 180, arc angle of 45
        new FramedArc(220, 100, 100, 100, 180, 45, canvas).setColor(Color.blue);
        new Text("start angle 180, arc angle 45", 200, 130, canvas).setColor(Color.blue);

        // a green filled one with a start angle of 0, arc angle of 200
        new FilledArc(10, 220, 150, 150, 0, 200, canvas).setColor(Color.green);
        new Text("start angle 0, arc angle 200", 30, 310, canvas).setColor(Color.green);

        // a yellow one with a start angle of 60, arc angle of 300 (PacMan!)
        new FilledArc(250, 220, 100, 100, 60, 300, canvas).setColor(Color.yellow);
        new Text("start angle 60, arc angle 300", 215, 330, canvas);
    }
}