/*
 * Course:       CSCI 215
 * Title:        Lab 1
 * Description:  DrawPad
 * Author:       Yu Chong
 * Copyright (c)2001 Yu Chong.  All Rights Reserved.
 */

import java.awt.Color;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;

/**
 * CLASS:    DrawPadView<BR>
 * PURPOSE:  This class handle all the GUI action and this is also
 *           the main class for the applet<BR>
 * IMPORT:   java.awt.Color, java.applet.Applet, java.awt.Graphics,
 *           java.awt.Image, java.awt.event.MouseEvent,
 *           java.awt.event.MouseListener, java.awt.event.MouseMotionListener,
 *           java.awt.event.KeyListener, java.awt.event.KeyEvent, Ellipse,
 *           Rectangle, Line, Polygon, DrawableShape, DrawPadDoc, Point<BR>
 * EXPORT:   New Class|DrawPadView<BR>New Method| init, keyPressed, keyReleased,
 *           keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited,
 *           mouseMoved, mousePressed, mouseReleased, paint, setSelectedColor,
 *           update, drawBorder, drawColorBar, drawCurrentColor,
 *           drawOptionBar<BR>
 */
public class DrawPadView extends Applet
                        implements MouseListener, MouseMotionListener, KeyListener
{
  //Private Attributes
  /** keep track of the last point */
  private Point endPoint;
  /** Keep track of all the shape and for the editing methods */
  private DrawPadDoc drawPadDoc = new DrawPadDoc();
  /** Current shape object for before adding to DrawPadDoc*/
  private DrawableShape currentShape=null;
  /** A flag to indicate whether a shape is selected in the list*/
  private boolean bSelectedShape=false;
  /** A flag to indicate whether a shape is being draw*/
  private boolean bDrawingShape=false;
  /** A flag to indicate whether a point box for a shape has been selected*/
  private boolean bSelectedPointBox=false;
  /** A flag to indicate whether we are changing the shape's color*/
  private boolean bChangingColor = false;
  /** Name of the option image files (upstate and downstate)*/
  private String imageNames[][] =  {{"Select.gif", "SelectDown.gif"},
                                    {"Line.gif", "LineDown.gif"},
                                    {"Rectangle.gif", "RectangleDown.gif"},
                                    {"FilledRectangle.gif", "FilledRectangleDown.gif"},
                                    {"Ellipse.gif", "EllipseDown.gif"},
                                    {"FilledEllipse.gif", "FilledEllipseDown.gif"},
                                    {"Polygon.gif", "PolygonDown.gif"},
                                    {"FilledPolygon.gif", "FilledPolygonDown.gif"}};
  /** array to contain the images for options*/
  private Image optionImages[][];
  /** Constant to indicate the image is in up-state*/
  private final byte IMAGE_UP = 0;
  /** Constant to indicate the image is in down-state*/
  private final byte IMAGE_DOWN = 1;
  /** Constant for the image size in pixel.  Image size is alway in Square*/
  private final byte IMAGE_SIZE = 20;
  /** Constant for half image size in pixel.  For faster calculation */
  private byte HALF_IMAGE_SIZE;
  /** Constant for 2 * image size in pixel.  For faster calculation */
  private byte DOUBLE_IMAGE_SIZE;
  /** Constant for Select Option*/
  private final byte OPT_SELECT           = 0;
  /** Constant for Line Option*/
  private final byte OPT_LINE             = 1;
  /** Constant for Rectangle Option*/
  private final byte OPT_RECTANGLE        = 2;
  /** Constant for Filled Rectangle Option*/
  private final byte OPT_FILLED_RECTANGLE = 3;
  /** Constant for Ellipseect Option*/
  private final byte OPT_ELLIPSE          = 4;
  /** Constant for Filled Ellipse Option*/
  private final byte OPT_FILLED_ELLIPSE   = 5;
  /** Constant for Polygon Option*/
  private final byte OPT_POLYGON          = 6;
  /** Constant for Filled Polygon Option*/
  private final byte OPT_FILLED_POLYGON   = 7;
  /** Constant for the path that the image files is in*/
  private final String imageDirectory = "images/";
  /** Constant for the border width */
  private final int BORDER_WIDTH = 5;
  /** Option that has been selected*/
  private int selectedOption = 0;
  /** Color that has been selected*/
  private int selectedColor = 0;
  /** Back Image buffer for drawing*/
  private Image backBufferImage;
  /** Graphic context associate with the back image buffer*/
  private Graphics backBufferGraphics;
  /** Drawing area width.  Default is 500, can be pass in from the html*/
  private int drawWidth = 500;
  /** Drawing area height.  Default is 400, can be pass in from the html*/
  private int drawHeight = 400;
  /** An Array of color that is available*/
  private final Color colorList[] = {Color.black,
                                     Color.blue,
                                     Color.cyan,
                                     Color.darkGray,
                                     Color.gray,
                                     Color.green,
                                     Color.magenta,
                                     Color.orange,
                                     Color.pink,
                                     Color.red,
                                     Color.white,
                                     Color.yellow};
  /** <BR>
   *  PRE:  None<BR>
   *  POST: Initialize all the variables and GUI for the applet<BR>
   */
  public void init()
  {
    HALF_IMAGE_SIZE = IMAGE_SIZE/2;
    DOUBLE_IMAGE_SIZE = IMAGE_SIZE * 2;
    optionImages = new Image[imageNames.length][2];
    for(int i = 0; i < imageNames.length; i++)
    {
        optionImages[i][IMAGE_UP] = getImage(getDocumentBase(),imageDirectory + imageNames[i][IMAGE_UP]);
        optionImages[i][IMAGE_DOWN] = getImage(getDocumentBase(),imageDirectory + imageNames[i][IMAGE_DOWN]);
    }
    addKeyListener(this);
    addMouseListener(this);
    addMouseMotionListener(this);
    String strDrawHeight = getParameter("DRAW_HEIGHT");
    String strDrawWidth = getParameter("DRAW_WIDTH");
    if(strDrawHeight!=null)
    {
      drawHeight = Integer.parseInt(strDrawHeight);
    }
    if(strDrawWidth!=null)
    {
      drawWidth = Integer.parseInt(strDrawWidth);
    }
    backBufferImage = createImage(drawWidth, drawHeight);
    backBufferGraphics = backBufferImage.getGraphics();
  }

  /** <BR>
   *  PRE:  Valid Graphic object.<BR>
   *  POST: Draw the color that we are using right now<BR>
   */
  private void drawCurrentColor(Graphics g)
  {
    int startX = 2;
    int xoffset=startX*IMAGE_SIZE;
    int yoffset=0;
    g.setColor(Color.white);
    g.fillRect(xoffset,yoffset,DOUBLE_IMAGE_SIZE+1, DOUBLE_IMAGE_SIZE+1);
    xoffset+=HALF_IMAGE_SIZE;
    yoffset+=HALF_IMAGE_SIZE;
    for(int i = 0; i < colorList.length; i++)
    {
      if(selectedColor == i)
      {
        g.setColor(colorList[i]);
        g.fillRect(xoffset, yoffset, IMAGE_SIZE, IMAGE_SIZE);
        g.setColor(Color.black);
        g.drawRect(xoffset, yoffset, IMAGE_SIZE, IMAGE_SIZE);
      }
    }
    g.setColor(Color.black);
    g.drawRect(DOUBLE_IMAGE_SIZE, 0, DOUBLE_IMAGE_SIZE-1, DOUBLE_IMAGE_SIZE-1);
    g.drawRect(DOUBLE_IMAGE_SIZE, 0, DOUBLE_IMAGE_SIZE+1, DOUBLE_IMAGE_SIZE+1);
  }

  /** <BR>
   *  PRE:  Valid Graphic object.<BR>
   *  POST: Draw the color bar to the given Graphics object<BR>
   */
  private void drawColorBar(Graphics g)
  {
    int startX = 4;
    int xoffset=startX*IMAGE_SIZE;
    int yoffset=0;
    int rowCounter = 0;

    g.setColor(Color.white);
    g.fillRect(startX*IMAGE_SIZE, 0, (colorList.length+1)/2 * IMAGE_SIZE +1, DOUBLE_IMAGE_SIZE+1);
    for(int i = 0; i < colorList.length; i++)
    {
      g.setColor(colorList[i]);
      if(selectedColor == i)
      {
        g.fill3DRect(xoffset, yoffset, IMAGE_SIZE, IMAGE_SIZE, false);
      }
      else
      {
        g.fill3DRect(xoffset, yoffset, IMAGE_SIZE, IMAGE_SIZE, true);
      }
      rowCounter ++;
      if(rowCounter==2)
      {
        rowCounter=0;
        xoffset += IMAGE_SIZE;
        yoffset = 0;
      }
      else
      {
        yoffset +=IMAGE_SIZE;
      }
    }
    g.setColor(Color.black);
    g.drawRect(startX*IMAGE_SIZE, 0, (colorList.length+1)/2 * IMAGE_SIZE +1, DOUBLE_IMAGE_SIZE+1);
  }

  /** <BR>
   *  PRE:  Valid Graphic object.<BR>
   *  POST: Draw the border for the drawing area<BR>
   */
  private void drawBorder(Graphics g)
  {
    g.setColor(Color.black);
    g.fillRect(0,0,BORDER_WIDTH, drawHeight);
    g.fillRect(drawWidth-BORDER_WIDTH,0,BORDER_WIDTH, drawHeight);
    g.fillRect(0,0,drawWidth, BORDER_WIDTH);
    g.fillRect(0,drawHeight-BORDER_WIDTH,drawWidth, BORDER_WIDTH);
  }

  /** <BR>
   *  PRE:  Valid Graphic object.<BR>
   *  POST: Draw the option bar to the given Graphics object<BR>
   */
  private void drawOptionBar(Graphics g)
  {
    int xoffset = 0;
    int yoffset = 0;
    byte colCounter = 0;

    g.setColor(Color.white);
    g.fillRect(0, 0, DOUBLE_IMAGE_SIZE+2, (imageNames.length+1)/2 * IMAGE_SIZE+2);
    for(int i = 0; i < imageNames.length; i++)
    {
      if(selectedOption == i)
      {
        g.drawImage(optionImages[i][IMAGE_DOWN], xoffset, yoffset, this);
      }
      else
      {
        g.drawImage(optionImages[i][IMAGE_UP], xoffset, yoffset, this);
      }
      colCounter ++;
      if(colCounter==2)
      {
        colCounter=0;
        yoffset += IMAGE_SIZE;
        xoffset = 0;
      }
      else{
        xoffset +=IMAGE_SIZE;
      }
    }
    g.setColor(Color.black);
    g.drawRect(0, 0, DOUBLE_IMAGE_SIZE+2, (imageNames.length+1)/2 * IMAGE_SIZE+2);
    xoffset = 0;
    yoffset = 0;
    for(int i = 0; i < (imageNames.length+1)/2+1; i++)
    {
      g.drawLine(0, yoffset, DOUBLE_IMAGE_SIZE, yoffset);
      yoffset+=IMAGE_SIZE;
    }
    for(int i = 0; i < 3; i++)
    {
      g.drawLine(xoffset, 0, xoffset, (imageNames.length+1)/2*IMAGE_SIZE);
      xoffset+=IMAGE_SIZE;
    }
  }

  /** <BR>
   *  PRE:  A valid Graphics Object<BR>
   *  POST: Will have drawPadDoc draw all its shape and also draw the
   *        current shape if we are doing Add shape.  Also will draw color bar
   *        and option bar<BR>
   */
  public void paint(Graphics g)
  {
    update(g);
  }

 /** <BR>
   *  PRE:  A valid Graphics Object<BR>
   *  POST: Will have drawPadDoc draw all its shape and also draw the
   *        current shape if we are doing Add shape.  Also will draw color bar
   *        and option bar. This method is override for double buffering
   *        technique.<BR>
   */
  public void update(Graphics g)
  {
    backBufferGraphics.setColor(Color.white);
    backBufferGraphics.fillRect(0,0,drawWidth, drawHeight);
    drawPadDoc.drawAllShapes(backBufferGraphics);
    if(currentShape!=null && bDrawingShape)
    {
      currentShape.paint(backBufferGraphics);
    }
    drawBorder(backBufferGraphics);
    drawCurrentColor(backBufferGraphics);
    drawColorBar(backBufferGraphics);
    drawOptionBar(backBufferGraphics);
    //Now copying the back buffer for display
    g.drawImage(backBufferImage, 0, 0, this);
  }

 /** <BR>
   *  PRE:  A valid MouseEvent Object<BR>
   *  POST: Set all the flags needed.  Also add shape to the list in some cases.
   *        This method was override from the interface MouseListener.<BR>
   */
  public void mouseReleased(MouseEvent e)
  {
    int x = e.getX();
    int y = e.getY();
    bChangingColor = false;
    bSelectedPointBox = false;
    if(bDrawingShape)
    {
      Point pt = new Point(x,y);
      switch(selectedOption)
      {
        case OPT_RECTANGLE:
        case OPT_FILLED_RECTANGLE:
        case OPT_ELLIPSE:
        case OPT_FILLED_ELLIPSE:
          if(bDrawingShape)
          {
            currentShape.setEndPoint(pt);
            bDrawingShape = false;
            drawPadDoc.addShape(currentShape);
            repaint();
          }
          break;
      }
    }
  }

 /** <BR>
   *  PRE:  A valid MouseEvent Object<BR>
   *  POST: Set all the flags needed.  Also add shape to the list in some cases.
   *        This will also keep track of last mouse point clicked.  Perform actions
   *        result from clicking at the option/color bar.  Also perform editing
   *        methods. This method was override from the interface
   *        MouseListener.<BR>
   */
  public void mousePressed(MouseEvent e)
  {
    int x = e.getX();
    int y = e.getY();

    /* check if it is one of the option image */
    if( x>=0 && x <= (DOUBLE_IMAGE_SIZE) && y>=0 && y <= ((imageNames.length+1)*IMAGE_SIZE)/2)
    {
      drawPadDoc.unSelectShape();
      bSelectedShape = false;
      if(!bDrawingShape)
      {
        x = (x==0)?0: x/IMAGE_SIZE;
        y = (y==0)?0: y/IMAGE_SIZE;
        selectedOption = (y*2+x) < imageNames.length ? (y*2+x): selectedOption;
        repaint();

        if(selectedOption == OPT_LINE)
        {
          currentShape = new Line();
          currentShape.setColor(colorList[selectedColor]);
        }
        else if(selectedOption == OPT_POLYGON || selectedOption == OPT_FILLED_POLYGON)
        {
          currentShape = new Polygon();
          currentShape.setColor(colorList[selectedColor]);
          if(selectedOption==OPT_FILLED_POLYGON)
          {
            currentShape.setFill(true);
          }
          else
          {
            currentShape.setFill(false);
          }
        }
      }
    }
    else if(x>=(4*IMAGE_SIZE) &&  //Color option bar
            x<=((colorList.length+9)*IMAGE_SIZE)/2 &&
            y>=0 &&
            y <= (DOUBLE_IMAGE_SIZE))
    {
      if(!bDrawingShape)
      {
        x = x/IMAGE_SIZE - 4;
        y = y/IMAGE_SIZE;
        selectedColor = (x*2+y) < colorList.length ? (x*2+y): selectedColor;

        if(currentShape!=null)
        {
          currentShape.setColor(colorList[selectedColor]);
        }
        if(bSelectedShape)
        {
          bChangingColor = true;
          drawPadDoc.setSelectedShapeColor(colorList[selectedColor]);
        }
        repaint();
      }
    }
    else if(x>(DOUBLE_IMAGE_SIZE) && y > (DOUBLE_IMAGE_SIZE))/*drawing area */
    {
      if(selectedOption!=OPT_SELECT)
      {
        drawPadDoc.unSelectShape();
        bSelectedShape = false;
      }
      Point pt = new Point(x,y);
      switch(selectedOption)
      {
        case OPT_SELECT:
          endPoint = pt.copyClone();
          currentShape = null;
          if(bSelectedShape) // now check for point box
          {
            bSelectedPointBox = drawPadDoc.selectPointBox(pt);
            if(bSelectedPointBox)
            {
              break;
            }
            drawPadDoc.unSelectShape();
          }
          bSelectedShape = drawPadDoc.selectShape(pt);

          if(!bSelectedShape)
          {
            drawPadDoc.unSelectShape();
            bSelectedShape = false;
          }
          else
          {
             setSelectedColor(drawPadDoc.getSelectedShapeColor());
          }
          repaint();
          break;
        case OPT_LINE:
            if((e.getModifiers()&e.BUTTON1_MASK)!=0)//Left mouse button
            {
              bDrawingShape = true;
              currentShape.removeLastPoint();
              currentShape.addPoint(pt);    // adding 2 point for rubberband effect
              currentShape.addPoint(pt);
            }
            else if((e.getModifiers()&e.BUTTON3_MASK)!=0)//right mouse button
            {
              currentShape.removeLastPoint();
              drawPadDoc.addShape(currentShape);
              bDrawingShape = false;
              currentShape = new Line();
              currentShape.setColor(colorList[selectedColor]);
            }
            repaint();
          break;
        case OPT_RECTANGLE:
          if(!bDrawingShape)
          {
            currentShape = new Rectangle(pt, pt);
            currentShape.setColor(colorList[selectedColor]);
            bDrawingShape = true;
          }
          break;
        case OPT_FILLED_RECTANGLE:
          if(!bDrawingShape)
          {
            currentShape = new Rectangle(pt, pt);
            currentShape.setColor(colorList[selectedColor]);
            currentShape.setFill(true);
            bDrawingShape = true;
          }
          break;
        case OPT_ELLIPSE:
          if(!bDrawingShape)
          {
            currentShape = new Ellipse(pt, pt);
            currentShape.setColor(colorList[selectedColor]);
            bDrawingShape = true;
          }
          break;
        case OPT_FILLED_ELLIPSE:
          if(!bDrawingShape)
          {
            currentShape = new Ellipse(pt, pt);
            currentShape.setColor(colorList[selectedColor]);
            currentShape.setFill(true);
            bDrawingShape = true;
          }
          break;
        case OPT_POLYGON:
        case OPT_FILLED_POLYGON:
            if((e.getModifiers()&e.BUTTON1_MASK)!=0)//Left mouse button
            {
              bDrawingShape = true;
              currentShape.removeLastPoint();
              currentShape.addPoint(pt);    // adding 2 point for rubberband effect
              currentShape.addPoint(pt);
            }
            else if((e.getModifiers()&e.BUTTON3_MASK)!=0)//right mouse button
            {
              currentShape.removeLastPoint();
              drawPadDoc.addShape(currentShape);
              bDrawingShape = false;
              currentShape = new Polygon();
              if(selectedOption==OPT_FILLED_POLYGON)
              {
                currentShape.setFill(true);
              }
              else
              {
                currentShape.setFill(false);
              }
              currentShape.setColor(colorList[selectedColor]);
            }
            repaint();
          break;
      }
    }
  }

 /** <BR>
   *  PRE:  A valid MouseEvent Object<BR>
   *  POST: For rubber band effect when drawing object. This method was
   *        override from the interface MouseMotionListener.<BR>
   */
  public void mouseMoved(MouseEvent e)
  {
    int x = e.getX();
    int y = e.getY();
    Point pt = new Point(x,y);
    switch(selectedOption)
    {
      case OPT_LINE:
      case OPT_POLYGON:
      case OPT_FILLED_POLYGON:
        if(bDrawingShape)
        {
          currentShape.removeLastPoint();
          currentShape.addPoint(pt);
          repaint();
        }
        break;
    }
  }

 /** <BR>
   *  PRE:  A valid MouseEvent Object<BR>
   *  POST: Show rubber band effect and perform editing functionality.  This method was
   *        override from the interface MouseMotionListener.<BR>
   */
  public void mouseDragged(MouseEvent e)
  {
    int x = e.getX();
    int y = e.getY();
    Point pt = new Point(x,y);
    switch(selectedOption)
    {
      case OPT_SELECT:
        if(bSelectedShape)
        {
          if(!bChangingColor){
            if(!bSelectedPointBox)
            {
              drawPadDoc.moveShape(pt.x-endPoint.x, pt.y-endPoint.y);
              endPoint = pt.copyClone();
            }
            else
            {
              drawPadDoc.moveSelectedPointBox(pt.x-endPoint.x, pt.y-endPoint.y);
              endPoint = pt.copyClone();
            }
            repaint();
          }
        }
        break;
      case OPT_RECTANGLE:
      case OPT_FILLED_RECTANGLE:
      case OPT_ELLIPSE:
      case OPT_FILLED_ELLIPSE:
        if(bDrawingShape)
        {
          currentShape.setEndPoint(pt);
          repaint();
        }
        break;
    }
  }

 /** <BR>
   *  PRE:  A valid KeyEvent Object<BR>
   *  POST: Perform editing functionality.  This method was
   *        override from the interface KeyListener.<BR>
   */
  public void keyPressed(KeyEvent e)
  {
    if(e.getKeyCode()==e.VK_DELETE)
    {
      if(bSelectedShape)
      {
        drawPadDoc.deleteSelectedShape();
        bSelectedShape = false;
        repaint();
      }
    }
    else if(e.getKeyCode()==e.VK_UP)
    {
      if(bSelectedShape)
      {
        drawPadDoc.moveSelectedShapeToFront();
        repaint();
      }
    }
    else if(e.getKeyCode()==e.VK_DOWN)
    {
      if(bSelectedShape)
      {
        drawPadDoc.moveSelectedShapeToBack();
        repaint();
      }
    }
    else if(e.getKeyCode()==e.VK_TAB)
    {
      if(!bSelectedPointBox && !bDrawingShape && selectedOption==OPT_SELECT)
      {
        if((e.getModifiers()&e.SHIFT_MASK)==0)
        {
          bSelectedShape=drawPadDoc.selectNextShape();
        }
        else
        {
          bSelectedShape=drawPadDoc.selectPreviousShape();
        }
        if(bSelectedShape)
        {
          setSelectedColor(drawPadDoc.getSelectedShapeColor());
        }
        repaint();
      }
    }
    else if(e.getKeyCode()==e.VK_C &&  //Copy
            (e.getModifiers()&e.CTRL_MASK)!=0)
    {
      drawPadDoc.copySelectedShape();
    }
    else if(e.getKeyCode()==e.VK_X &&  //Cut
            (e.getModifiers()&e.CTRL_MASK)!=0)
    {
      drawPadDoc.copySelectedShape();
      drawPadDoc.deleteSelectedShape();
      repaint();
    }
    else if(e.getKeyCode()==e.VK_V &&  //Paste
            (e.getModifiers()&e.CTRL_MASK)!=0)
    {
      if(drawPadDoc.pasteShape())
      {
        setSelectedColor(drawPadDoc.getSelectedShapeColor());
        drawPadDoc.moveShape(DOUBLE_IMAGE_SIZE, DOUBLE_IMAGE_SIZE);
        selectedOption = OPT_SELECT;
        currentShape=null;
        bDrawingShape = false;
        repaint();
      }
    }
    else if(e.getKeyCode()==e.VK_ESCAPE) // equivelent as right mouse click
    {
      switch(selectedOption)
      {
        case OPT_LINE:
          currentShape.removeLastPoint();
          drawPadDoc.addShape(currentShape);
          bDrawingShape = false;
          currentShape = new Line();
          currentShape.setColor(colorList[selectedColor]);
          repaint();
          break;
        case OPT_POLYGON:
        case OPT_FILLED_POLYGON:
          currentShape.removeLastPoint();
          drawPadDoc.addShape(currentShape);
          bDrawingShape = false;
          currentShape = new Polygon();
          if(selectedOption==OPT_FILLED_POLYGON)
          {
            currentShape.setFill(true);
          }
          else
          {
            currentShape.setFill(false);
          }
          currentShape.setColor(colorList[selectedColor]);
          repaint();
          break;
      }
    }
  }

 /** <BR>
   *  PRE:  A valid Color Object<BR>
   *  POST: set and update the color bar to the input color<BR>
   */
  public void setSelectedColor(Color c)
  {
    for(int i = 0; i < colorList.length; i++)
    {
      if(colorList[i].equals(c))
      {
        selectedColor = i;
        return;
      }
    }
  }

 /** <BR>
   *  PRE:  A valid KeyEvent Object<BR>
   *  POST: This method was override from the interface KeyListener.<BR>
   */
  public void keyTyped(KeyEvent e)
  {
  }

 /** <BR>
   *  PRE:  A valid KeyEvent Object<BR>
   *  POST: This method was override from the interface MouseMotionListener.<BR>
   */
  public void mouseEntered(MouseEvent e)
  {
  }

 /** <BR>
   *  PRE:  A valid MouseEvent Object<BR>
   *  POST: This method was override from the interface MouseListener.<BR>
   */
  public void mouseClicked(MouseEvent e)
  {
  }

 /** <BR>
   *  PRE:  A valid KeyEvent Object<BR>
   *  POST: This method was override from the interface MouseMotionListener.<BR>
   */
  public void mouseExited(MouseEvent e)
  {
  }

 /** <BR>
   *  PRE:  A valid KeyEvent Object<BR>
   *  POST: This method was override from the interface KeyListener.<BR>
   */
  public void keyReleased(KeyEvent e)
  {
  }
}
