We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Printing values from a int[] to the screen
Page Index Toggle Pages: 1
Printing values from a int[] to the screen (Read 463 times)
Printing values from a int[] to the screen
Feb 16th, 2010, 12:28am
 
Hello!

I have used Processing for a couple of weeks and managed to correct my code by using the reference.

I am doing a program that uses a "terminal" embedded into the program screen. The terminal is a simple white screen created by rect().
I have values in tables that I want to print to this terminal. The terminal is there because I want to do a standalone application.

This will update the terminal by printing out for example the length of the first table. It works really fine, it prints out any data to the "terminal" as it is supposed to.

void drawTerminal()
{
 int i = time.length;
 fill(255);
 rect(1,350, 498, 100);
 
 fill(0);
  if(i !=0)
  {

text(i, 10, 360);
   
  }
}


BUT my question is: If I try to access data that has been stored in that very table (change text(i,10,360) to text(time[i],10,360)) nothing is printed in the screen. Huh

Do I have to use some sort of java stuff like get.Something() to get the values out from the tables?

//I have no other problems with those table values, they can be saved to and loaded from text files, printed into the ordinary table etc.
Re: Printing values from a int[] to the screen
Reply #1 - Feb 16th, 2010, 12:45am
 
No need to answer. *embarrased*  If a table is n rows long there will of course be nothing to print in row n, because the numbers are counted from 0 (the last row in a table with 10 rows is #9).  Cheesy

Changed i to i-1 and it works as it's supposed to...
Page Index Toggle Pages: 1