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 › Unable to find Class
Page Index Toggle Pages: 1
Unable to find Class (Read 687 times)
Unable to find Class
Aug 29th, 2008, 2:54pm
 
I am a newbie to Processing but am an experience programmer in a number of languages, including Java.

My problem relates to chapter 3 from the visualizing data book, where an image is dragged into the project along with a data file and an class called Table to read the data file.

When running the code I get the error:
Cannot find class or type named “Table”

Could someone possibly point me in the right direction.

The code I am using is copied from the book and shown below:

PImage mapImage;
Table locationTable;
int rowCount;
 
 void setup(){
   size(640, 400);
   mapImage = loadImage("map.png");
   // Make a data table form a file that contains
   // the coordinates of each site.
   locationTable = new Table("locations.tsv");
   // The row count will be used a lot, so sotre it globally.
   rowCount = locationTable.getRowCount();
 }
 
 }

void draw(){
  background(255);
  image(mapImage,0 ,0);
 
  //loop through the rows of the locations file and draw the points.
  for (int row = 0; row < rowCount; row++){
    float x = locationTable.getFloat(row,1); //column 1
    float y = loationTable.getFloat(row,2); // column 2
    ellipse(x, y, 9, 9);
  }

Re: Unable to find Class
Reply #1 - Aug 29th, 2008, 4:28pm
 
You need this file: http://benfry.com/writing/map/Table.pde

(See the second paragraph under "Locations on a Map" on p.32)
Re: Unable to find Class
Reply #2 - Aug 29th, 2008, 4:38pm
 
The file has been down loaded and dragged into the sketch.
Re: Unable to find Class
Reply #3 - Aug 29th, 2008, 5:38pm
 
I have found the answer.  There are too many braces in the setup part of the code.  It works fine now!
Page Index Toggle Pages: 1