/* The RandomStrings applet on which this applet is based shows randomly colored and positioned copies of a message in several randomly chosen fonts. This applet extends that one so that when the user clicks on the applet, it is redrawn (with new random choices). */ import java.awt.event.*; public class ClickableRandomStrings extends RandomStrings implements MouseListener { public void init() { // When the applet is created, do the initialization // of the superclass, RandomStrings. Then set this // applet to listen for mouse events on the // "drawingSurface". (The drawingSurface variable // is defined in the RandomStrings class and // represents a component that fills the entire applet.) super.init(); drawingSurface.addMouseListener(this); } public void mousePressed(MouseEvent evt) { // When user presses the mouse, tell the system to // call the drawingSurface's paintComponent() method. drawingSurface.repaint(); } public void mouseEntered(MouseEvent evt) { } // These empty routines public void mouseExited(MouseEvent evt) { } // are required by the public void mouseClicked(MouseEvent evt) { } // MouseListener interface. public void mouseReleased(MouseEvent evt) { } } // end class ClickableRandomStrings