Package edu.byu.phun2d

This is the Phun2D package which was created to do simple 2D drawings and animations.

See:
          Description

Class Summary
Arc This objec will draw an elliptical arc.
Axes This creates a new drawable DrawObj that can be added to a scene or a Group.
Color This is an object that represents a color.
Demo  
DrawObj This is the superclass of every object that can be drawn.
Group A Group collects a series of other DrawObj objects to be drawn, including other GroupObjs.
Line A Line draws a straight line between points (x1,y1) and (x2,y2).
Oval This class draws an oval based on a center point and a width and height.
Point A simple 2D point with X and Y coordinates.
Rect This class will draw a rectangle based on a center point and a width and height.
Text This will draw a string of text on the screen.
Triangle This class will draw a triangle based on any three points.
Win2D This is the basic class for displaying a window on the screen.
 

Package edu.byu.phun2d Description

This is the Phun2D package which was created to do simple 2D drawings and animations. The goal is to create drawings by adding drawable objects to a window. Any changes that a program makes to those drawable objects will be instantly visible. This supports animations and it supports learning to program by immediately seeing the results of various program actions.

You begin using the Phun2D package by creaing a Win2D object. This is the window in which your drawings will appear. You can create as many of these windows as you like. Each has its own drawing.

Once you have created a Win2D you create drawings by adding drawable objects to that window. To see all of the possible drawable objects look at the Obj2D class. Obj2D is the superclass for all things drawable. Looking at its list of subclasses will show you the various drawable objects that you can add.

Example program:

import edu.byu.phun2d.*;

public class Demo
{
        public static void main(String args[])
        {
                Win2D win = new Win2D("My Demo");       
                        //create a new window at the default location.
                win.add(new RectObj(0,0,3,5)); 
                        // add a black rectangle at the origin
                Oval2D c = new Oval(4,-4,2,2); 
                        // create a circle diameter 2 at (4,-4);
                c.setFillColor(Color.RED);         
                        // make the circle red
                c.setLineColor(null);                   
                        // remove the border
                win.add(c);                                             
                        // make the circle visible by adding it to win.
        }
}