/*
    +---------------------------------------------------------------+
    |                                                               |
    |   A Java Program to Draw Stick Figures                        |
    |                                                               |
    |       Author: Fritz Ruehr                                     |
    |       Date:   2 February 2000                                 |
    |       Class:  CS 231                                          |
    |       School: Willamette University                           |
    |                                                               |
    |       Vers.:  6.0 (mini-API using centered circles and lines) |
    |                                                               |
    |   See Vers. 1.0 for series description.                       |
    |                                                               |
    |   This fifth version (6.0) uses several separate methods      |
    |   for drawing cricles and lines from centers. It also uses    |
    |   methods to access global x and y co-ordinates for movement. |
    |                                                               |
    +---------------------------------------------------------------+
*/
    //  *
    //  *   CODE ELIDED FOR BREVITY: SEE CAFE AWT APPLET TEMPLATE
    //  *
   
/*  -------------------------------------------------------
    METHOD drawFigure: two int parameters (x,y), no result.
    Draws a stick figure with "head" centered at (x,y). 
    -------------------------------------------------------  */
    
    public void drawFigure(Graphics graphic, int x, int y) {

        int head  = 24;     // head size (width and height)
        int torso = 48;     // length (or height) of torso
        int span  = 36;     // combined width of both arms
        int neck  = 18;     // distance down from head to arms
        int leg   = 18;     // length of each leg (diagonal)
   
        ... .centeredCircle ( x, y, head );     // draw the head

        moveDown(head/2);                       // move y to bottom of head
        ... .centeredVertLine ( x, y, torso );  // draw the body

        moveDown(neck);                         // move y down to arm level
        ... .centeredHorLine ( x, y, span );    // draw the arms

        moveUp(neck);
        moveDown(torso);                        // move y to bottom of torso
        ... .diagLineDL ( x, y, leg );          // draw the left leg
        ... .drawLineDR ( x, y, leg );          // draw the right leg
        
    } // END method drawFigure


/*  ----------------------------------------------------------------
    The standard applet paint method: Graphics parameter, no result. 
    ----------------------------------------------------------------  */
    
    public void paint(Graphics graphic) {
        
    /*  ----------------------------------------
        Draw three figures in the applet window.
        ----------------------------------------  */
        
        drawFigure(graphic,  48, 48);       // Draw figure with (head) center at ( 48, 48).
        drawFigure(graphic, 148, 48);       // Draw figure with (head) center at (148, 48).
        drawFigure(graphic, 100,100);       // Draw figure with (head) center at (100,100).
        
    } // END method graphics

} // END class Applet