//******************************************************************** // DotsMouseListener.java Author: Lewis and Loftus // // Represents a listener object for mouse events. //******************************************************************** import java.applet.Applet; import java.awt.*; import java.awt.event.*; class DotsMouseListener implements MouseListener { private Dots applet; //----------------------------------------------------------------- // Stores a reference to the applet. //----------------------------------------------------------------- public DotsMouseListener (Dots applet) { this.applet = applet; } //----------------------------------------------------------------- // Determines the point at which the mouse is clicked, sets the // point in the applet, then forces the applet to repaint. //----------------------------------------------------------------- public void mouseClicked (MouseEvent event) { Point clickPoint = event.getPoint(); applet.setPoint (clickPoint); applet.repaint(); } //----------------------------------------------------------------- // Provide empty definitions for unused event methods. //----------------------------------------------------------------- public void mousePressed (MouseEvent event) {} public void mouseReleased (MouseEvent event) {} public void mouseEntered (MouseEvent event) {} public void mouseExited (MouseEvent event) {} }