title: Displaying text in an object seems to break new text being generated
body: <p>I am trying to create a program that renders blocks of text as moving object to be used in Box2D. You start by typing some words, the words themselves scale with the amount of characters. Then, when pressing enter, the program separates the words and put each of them inside an Array List. It's all good after the first enter, however when typing text after that, the text doesn't function as intended. It's all wonky. But when I remove the part that displays the text inside the TEMPTEXT class, and only displays the rectangle, it all works perfectly.</p>
  <p>Here is my code:</p>
  <pre><code>PFont xanhMono;
  
  String quote = &quot;&quot;;
  String tempQuote;
  
  ArrayList&lt;TEMPTEXT&gt; box;
  
  float tw;
  float ts=200;
  
  float qtX, qtY, qtW, qtH;
  int qtStart, qtEnd, qtNum;
  
  void setup() {
    size(800, 800);
    pixelDensity(displayDensity());
    xanhMono = createFont(&quot;XanhMono-Regular.ttf&quot;, 1000);
    box = new ArrayList&lt;TEMPTEXT&gt;();
  }
  
  void draw() {
    background(240);
    textFont(xanhMono);
    textSize(int(ts));
    textLeading(int(ts));
    textAlign(LEFT, TOP);
    fill(0);
    text(quote, 0, 0, width+50, height);
    if (frameCount%60&lt;30) {
      float twq = textWidth(quote);
      line(twq, 0, twq, ts);
    }
    for (TEMPTEXT txt : box) {
      txt.display();
    }
  }
  
  class TEMPTEXT{
    
    float x;
    float y;
    float speed;
    float gravity;
    float h;
    float w;
    String q;
    
    TEMPTEXT(float tempX, float tempY, float tempW, float tempH, String tempQ){
      x = tempX;
      y = tempY;
      w = tempW;
      h = tempH;
      q = tempQ;
      speed = 0;
      gravity = 0.1;
    }
    
    void display(){
      noFill();
      stroke(2);
      rect(x, y, w, h);
      //if i delete the next 3 lines, everything is all good
      textSize(h);
      textAlign(LEFT,TOP);
      text(q, x, y);
    }
  }
  
  void keyTyped() {
    if (key == '\n' ) {
      quote = trim(quote);
  
      qtStart = 0;
      qtEnd = 0;
      qtNum = 0;
      qtX = 0;
      qtY = 0;
      qtW = 0;
  
      tempQuote = &quot;&quot;;
  
      for (int i = 0; i &lt; quote.length(); i++) {
        if (quote.charAt(i)==' ') {
          qtEnd = i;
          tempQuote = quote.substring(qtStart, qtEnd);
  
          qtW = textWidth(tempQuote);
          qtH = ts;
          qtX = ts/2*qtStart;
          TEMPTEXT p = new TEMPTEXT(qtX, qtY, qtW, qtH, tempQuote);
          box.add(p);
  
          qtNum++;
          qtStart = i+1;
        } else if (i==quote.length()-1) {
          tempQuote = quote.substring(qtStart, quote.length());
  
          qtW = textWidth(tempQuote);
          qtH = ts;
          qtX=ts/2*qtStart;
          TEMPTEXT p = new TEMPTEXT(qtX, qtY, qtW, qtH, tempQuote);
          box.add(p);
        }
      }
      quote = &quot;&quot;;
    } else  if (key == BACKSPACE) {
      if (quote.length() &gt; 0) {
        quote = quote.substring(0, quote.length()-1);
      }
    } else {
      quote=quote+key;
    }
    tw=textWidth(quote);
    if (tw!=0) {
      ts*=width/tw;
      if (ts&gt;=height) {
        ts=height/1.5;
      }
    }
  }
  </code></pre>