title: Null pointer exception in animation thread handledraw()
body: <p>I'm very new to java (and to object oriented programming for that matter). As a first java project I've been instructed to get a tag cloud engine applet up and running. So I found WordCram and a small example bit of code for using PApplets and thought I'd have an easy time...</p>
  
  <p>But while my code doesn't generate any errors per-se, it throws the following upon running:</p>
  
  <pre><code>Exception in thread "Animation Thread" java.lang.NullPointerException
      at processing.core.PApplet.handleDraw(PApplet.java:2336)
      at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
      at processing.core.PApplet.run(PApplet.java:2176)
      at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>I have a TON of code, and I'm hesitant to post it all here... But over the course of trying to get to the bottom of my code I'm always frustrated at how little of the code the inquirer gives: so I'll tentatively paste it here and I'll look out for people telling me to reformat or edit out some or most of it.</p>
  
  <p>First of two classes:</p>
  
  <pre><code>package tagengine;
  
  import java.awt.*;
  
  public class TagFrame extends Frame {
  
      public TagFrame() 
      {
          super("Embedded PApplet");
          Engine embed = new Engine();
          setLayout(new BorderLayout());
          add(embed, BorderLayout.CENTER);
          embed.init();   
      }
  
      public static void main(String[] args)
      {
          TagFrame tagFrame = new TagFrame();
      }
  }
  </code></pre>
  
  <p>And the second:</p>
  
  <pre><code>package tagengine;
  
  import processing.core.PApplet;
  import processing.core.PFont;
  import processing.core.PVector;
  import wordcram.*;
  
  public class Engine extends PApplet {
  
      @Override public void setup() {
          this.size(900, 500);
          this.colorMode(HSB);
          this.noLoop();
          this.setVisible(true);
      }
  
      @Override public void draw() {
          this.background(68);
          new WordCram(this)
                  .fromWebPage("http://en.wikipedia.org/wiki/Barcamp")
                  .withColors(color(0, 0, 0),
                  color(0, 0, 255),
                  color(30, 255, 255)) // mustard, red)
                  .withFonts(PFont.list())
                  .withAngler(moreRandomByWeight())
                  .withPlacer(crazyPlacer())
                  .sizedByWeight(8, 100)
                  .maxNumberOfWordsToDraw(300)
                  .drawAll();
      }
  
      WordAngler moreRandomByWeight() {
          return new WordAngler() {
              @Override public float angleFor(Word w) {
                  float range = (1 - w.weight) * PI;
                  return random(-range, range);
              }
          };
      }
  
      WordPlacer crazyPlacer() {
          return new WordPlacer() {
              @Override public PVector place(Word w, int rank, int words,
                      int ww, int wh, int fw, int fh) {
                  float x = (fw - ww) * (1 - w.weight);
                  float y = random(fh - wh);
                  return new PVector(x, y);
              }
          };
      }
  
      @Override public void mousePressed() {
          redraw();
      }
  }
  </code></pre>