/** * File: FirstApplet.java * Author: Java Java Java * Description: This applet plays the click-me-not game with the user. */ import java.awt.*; import java.applet.Applet; import java.awt.event.*; /* * The FirstApplet class plays the click-me-not game with the user. * @author Java Java Java */ public class FirstApplet extends Applet implements ActionListener { private Button clickMe; // Declare the button /** * The init() method initializes the applet. */ public void init() { clickMe = new Button("Click Me Not!"); // Create the button clickMe.addActionListener(this); // Activate the button add(clickMe); // Add it to the applet } // init() /** * The actionPerformed() method is called whenever the button is clicked. */ public void actionPerformed (ActionEvent e) { if (clickMe.getLabel().equals("Click Me!")) clickMe.setLabel("Click Me Not!"); else clickMe.setLabel("Click Me!"); } // actionPerformed() } // End of FirstApplet