Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : updating text

$
0
0

When you only want to see the last line / temp var (in my code), show it via text() and don't use val.

That works together with background().

You can also choose a font and a fontsize and a color for the text.

text() also allows to define a rect that will not be exceeded even by too long text.

Hope this helps!

Greetings, Chrisir



like this...



  1. //String val="pwwe";
  2. int j=0;
  3. void setup()
  4. {
  5.   size(500, 500);
  6.   frameRate(1);
  7.   textSize(32);
  8. }
  9. void draw()
  10. {
  11.   background(111);
  12.   //myPort.write("temp?");
  13.   int  i=0;
  14.   String temp="";
  15.   while ( i < 10) {
  16.     temp = temp+char(i+j+65) ;
  17.     i++;
  18.   }
  19.   j++;
  20.   // val = temp+"\n"+val;
  21.   //println(val);
  22.   if (temp != null && temp.length() > 0) {
  23.     text(temp, 50, 100, 110, 200);
  24.   }
  25. }


Viewing all articles
Browse latest Browse all 1768

Trending Articles