FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   set text position to next line
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: set text position to next line  (Read 245 times)
c
Guest
Email
set text position to next line
« on: May 7th, 2004, 2:32am »

hi there
 
how could i trace sth like text().lenght so that i could switch to the next line? sth like:  
(director: " \ " i guess)  
 
x=50, y=50;
 
text(String one, x,y);
if(text.char.number > 100)
{
  y+=30;
}  
 
 
thanks for help
christian
 
narain


Re: set text position to next line
« Reply #1 on: May 7th, 2004, 6:31am »

I guess you'd have to first split your string, then draw each 100-character chunk onto its new line.
 
Equivalently, you can just draw substrings:
Code:
x = 50; y = 50;
String str;
int start = 0;
while (start < str.length) {
  int end = (int) min(start+100, str.length);
  text(str.substring(start,end), x,y);
  start += 100;
  y += 30;
}
 
c
Guest
Email
Re: set text position to next line
« Reply #2 on: May 10th, 2004, 12:22am »

thank you, narain.
 
the problem is: i want to watch traffic via the
carnivorePE-software for processing.  
 
i want to store the "old" data in an array so that
the string printed out on screen always contains the
whole data, not only the current, "new" one.
but this is something else...
 
c
 
Pages: 1 

« Previous topic | Next topic »