@@ -0,0 +1,2074 @@
+//*****************************************************************************%0A//    Filename: Poly.java%0A//%0A//      Author: David C. Drake (http://davidcdrake.com)%0A//%0A// Description: Contains a Poly class for creation and manipulation of%0A//              polygons.%0A//*****************************************************************************%0A%0Aimport java.applet.Applet;%0Aimport java.awt.*;%0Aimport java.awt.event.*;%0A%0Apublic class Poly extends Applet implements MouseListener, MouseMotionListener%0A%7B%0A  final int MAX_POINTS = 100;%0A  int%5B%5D x = new int%5BMAX_POINTS%5D;%0A  int%5B%5D y = new int%5BMAX_POINTS%5D;%0A  int points = 0, position;%0A  boolean finished = false;%0A%0A  public void init()%0A  %7B%0A    addMouseListener(this);%0A    addMouseMotionListener(this);%0A    setBackground(Color.black);%0A    resize(300,300);%0A  %7D%0A%0A  public void paint(Graphics g)%0A  %7B%0A    g.setColor(Color.green);%0A    if (points %3E 0)%0A    %7B%0A      g.drawPolyline(x, y, points);%0A    %7D%0A    if (finished)%0A    %7B%0A      g.fillPolygon(x, y, points);%0A    %7D%0A  %7D%0A%0A  public void mousePressed(MouseEvent event)%0A  %7B%0A    if (finished == false)%0A    %7B%0A      x%5Bpoints%5D = event.getPoint().x;%0A      y%5Bpoints%5D = event.getPoint().y;%0A      if (points %3E 0 &&%0A          Math.abs(x%5Bpoints%5D - x%5B0%5D) %3C 10 &&%0A          Math.abs(y%5Bpoints%5D - y%5B0%5D) %3C 10)%0A      %7B%0A        finished = true;%0A      %7D%0A      points++;%0A    %7D%0A    else%0A    %7B%0A      int currentX = event.getPoint().x;%0A      int currentY = event.getPoint().y;%0A      for (int n = points - 1; n %3E= 0; n--)%0A      %7B%0A        if (Math.abs(currentX - x%5Bn%5D) %3C 10 && Math.abs(currentY - y%5Bn%5D) %3C 10)%0A        %7B%0A          position = n;%0A        %7D%0A      %7D%0A    %7D%0A    repaint();%0A  %7D%0A%0A  public void mouseDragged(MouseEvent event)%0A  %7B%0A    if (finished)%0A    %7B%0A      Point point = event.getPoint();%0A      x%5Bposition%5D = point.x;%0A      y%5Bposition%5D = point.y;%0A    %7D%0A    repaint ();%0A  %7D%0A%0A  public void mouseClicked(MouseEvent event) %7B%7D%0A  public void mouseMoved(MouseEvent event) %7B%7D%0A  public void mouseReleased(MouseEvent event) %7B%7D%0A  public void mouseEntered(MouseEvent event) %7B%7D%0A  public void mouseExited(MouseEvent event) %7B%7D%0A%7D%0A

Add Poly.java