Corrections to Chapter 7 of Java Secrets, Controlling Applets

p. 349: If the target is the load button, then the readPage() method should be called, not the loadApplet() method. That is, the action() method should read:

  public boolean action(Event e, Object what) {

    if (e.target == restartButton) {
      restart();
      return true;
    }
    else if (e.target == reloadButton) {
      reload();
      return true;
    }
    else if (e.target == loadButton) {
      readPage(thePage.getText());
      return true;
    }
    else if (e.target == removeButton) {
      removeApplet();
      return true;
    }
    else if (e.target == thePage) {
      loadApplet();
      return true;
    }

    return false;

  }

[ Java Secrets Corrections | Java Secrets Home Page | Table of Contents | Examples | About the CD | Order ]

Copyright 2002 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified DXecember 28, 2002