/*
 * CS5App.java
 *
 * Homework # 4
 * Problem  # 1
 *
 * Name:
 * Date:
 * Time spent:
 *
 * Comments! :
 * 
 *
 */

import java.awt.*;

class CS5App
{
    public static void main(String[] args)
    {
        GrCanvas canvas = G.createCanvas();
        
        // putting origin in the upper left is customary for graphics
        canvas.setOrigin(GrCanvas.ORIGIN_UL);   
        
        // this tells the window how to resize when its corner is dragged
        canvas.changeCoordsWith(GrCanvas.XY_STRETCH_SQUARE_AR);
        // XY_STRETCH_NONSQUARE_AR is the other option... try it!
        
        // this specifies the coordinate system: xmin, xmax, ymin, ymax
        canvas.updateCoords(0,500,0,500);
            
        // this creates an image from a file: x, y, filename
        // I believe java can handle only gif and jpg files...    
        GrImage spam = new GrImage(10,200,"../spam.gif");
        
        // this creates a text object: x, y, point size, text, color
        GrText text = new GrText(300,300,48,"Hi!",Color.green);
        
        // this should be familiar...
        GrRectangle rect = new GrRectangle(200,400,100,50,Color.blue);
        
        // now, we add each of these things to the canvas and 
        //      then we repaint it, which ensures that it will appear
        canvas.add(spam);
        canvas.add(text);
        canvas.add(rect);
        canvas.repaint();
        
                
        // pause for one second
        H.pause(1000);
        
        // here is a simple sound-playing mechanism --
        // it does not handle mp3's, but it does handle
        // uncompressed .wav, .au, .aiff, and .mid files
        S.playSound("../bottle-open.wav");
        
        // now, we remove one of the things and again repaint:
        canvas.remove(spam);
        canvas.repaint();
        
    } // end main
    
}