// CS7 - // This is a simple applet that changes its button text. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class OnOff extends JApplet { public void init() { // get access to the applet's top-level container Container pane = getContentPane(); // create a component (button in this case) final JButton flipButton = new JButton("Message Hidden"); // add components to container pane.add(flipButton); // add the listener flipButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (flipButton.getText().equals("Message Hidden")) flipButton.setText("I love Cheesy Poofs!"); else flipButton.setText("Message Hidden"); // reset } }); } // end init() } // end of class