import java.awt.*;

// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.

/** An example to illustrate the GraphicsUtil package.
 *  The thick lines, rectangles, etc. have a normal
 *  sized one drawn in the center for comparison.
 */

public class GraphicsUtilTest extends Frame{
  
  public static void main(String[] args) {
    new GraphicsUtilTest();
  }

  public GraphicsUtilTest() {
    super("GraphicsUtilTest");
    setBackground(Color.white);
    resize(900, 700);
    show();
  }
  
  public void paint(Graphics g) {
    int x=50, top=30;
    for(int i=0; i<10; i++) {
      x = 50;
      // Thick arc
      GraphicsUtil.drawArc(g, x, 60*i+top, 75, 75,
                           30*i, 90, 2*i+1,
                           Color.lightGray);
      // Regular arc
      g.drawArc(x, 60*i+top, 75, 75, 30*i, 90);
      x = x + 100;
      // Thick rectangle
      GraphicsUtil.drawRect(g, x, 60*i+top, 75, 35,
                            2*i+1, Color.gray);
      // Regular rectangle
      g.drawRect(x, 60*i+top, 75, 35);
      x = x + 100;
      // Thick oval
      GraphicsUtil.drawOval(g, x, 60*i+top, 75, 35,
                            2*i+1, Color.darkGray);
      // Regular oval
      g.drawOval(x, 60*i+top, 75, 35);
      x = x + 100;
      // Thick rounded rectangle
      GraphicsUtil.drawRoundRect(g, x, 60*i+top, 75, 35,
                                 20, 10,
                                 2*i+1, Color.lightGray);
      // Regular rounded rectangle
      g.drawRoundRect(x, 60*i+top, 75, 35, 20, 10);
      x = x + 100;
      // Thick 3D rectangle
      GraphicsUtil.draw3DRect(g, x, 60*i+top, 75, 35,
                              true, 2*i+1, Color.gray);
    }
    for(x=-150; x<=150; x=x+75)
      for(int y=-250; y<=250; y=y+100)
        // Thick line
        GraphicsUtil.drawLine(g, 700, 350, 700+x, 350+y,
                              20, Color.gray);
    for(x=-150; x<=150; x=x+75)
      for(int y=-250; y<=250; y=y+100)
        // Regular line
        g.drawLine(700, 350, 700+x, 350+y);
  }

  /** Honor requests to quit the window */
  
  public boolean handleEvent(Event event) {
    if (event.id == Event.WINDOW_DESTROY) 
      System.exit(0);
    return(super.handleEvent(event));
  }
}


