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

/** A better whiteboard that lets you enter
 *  text in addition to freehand drawing.
 */

public class Whiteboard1 extends SimpleWhiteboard1 {
  private FontMetrics fm;

  public void init() {
    super.init();
    Font font = new Font("Helvetica", Font.BOLD, 20);
    setFont(font);
    fm = getFontMetrics(font);
  }

  public boolean keyDown(Event e, int key) {
    String s = String.valueOf((char)key);
    getGraphics().drawString(s, lastX, lastY);
    return(record(lastX + fm.stringWidth(s), lastY));
  }
}

