import java.applet.Applet;
import java.awt.*;

// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.

public class ShipSimulation extends Applet
                            implements Runnable {
  ...
  
  public void run() {
    Ship s;
    for(int i=0; i<ships.length; i++) {
      s = ships[i];
      s.move(); // Update location
    }
    repaint();
  }

  ...
  
  public void paint(Graphics g) {
    Ship s;
    for(int i=0; i<ships.length; i++) {
      s = ships[i];
      s.draw(s); // draws at current location
    }
  }
}

