
/**
 * FirstFrame - Brings up a window and draws something
 * 
 * Nina
 * Aug 27
 */
import java.awt.*; 
import java.awt.geom.*; // for Ellipse2D


// ApplicationFrame is given in book, brings up a window
public class FirstFrame extends ApplicationFrame
{
    /* Constructor */
    public FirstFrame(String s) 
    {
    super(s); // ApplicationFrame's constructor
    setVisible(true); // Put the window on the screen
    }


    /* Override the paint method to draw something in the window */
    public void paint(Graphics g) 
    {
    Graphics2D g2 = (Graphics2D) g;  // Cast g to a Graphics2D
    Ellipse2D ellipse = new Ellipse2D.Float(200,175,100,50);
    // speifies upper left corner, width and height of bounding rect
    g2.setPaint(Color.black);  // now anything drawn is black
    g2.draw(ellipse);  // draw draws an outline
    Ellipse2D circle = new Ellipse2D.Float(225,175,50,50);
    g2.setPaint(Color.blue);
    g2.fill(circle);  // fill draws a filled shape
    g2.setPaint(Color.black);  
    circle = new Ellipse2D.Float(240, 190, 20,20);
    g2.fill(circle);
    }

    /* Main function, starts up when class is called as program */
    public static void main(String[] args) 
    {
    new FirstFrame("My First Frame");
    }
    
}
