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 › void draw ()  - must contain a method body
Page Index Toggle Pages: 1
void draw ()  - must contain a method body? (Read 526 times)
void draw ()  - must contain a method body?
Sep 27th, 2007, 12:35am
 
Hi
When I play the following code, the statement ;
the declaration of the non-abstract and non-native method "void draw()" must contain a method body.

What does this mean>?
The code is below;

PImage polarfleece;
void setup (){
size (600,600);
loadImage("polarfleece.JPG");
image(polarfleece, 0, 0);
filter(GRAY);
filter(POSTERIZE, 2);


}  

void draw ();  
{  
   polarfleece.loadPixels ();  
   for (int x = 0; x< polarfleece.width; x++)
   {
  for (int y=0; y< polarfleece.height; y++)
  {
 int i = (y * polarfleece.width + x);
 if (polarfleece.pixels [i] == color(0) ) {  
     ellipse (x,y,40,40) ;  
 }  
 else if (polarfleece.pixels [i] == color(1) ) {  
 }
  }
   }
}

Any help would be great, thanks
Re: void draw ()  - must contain a method bod
Reply #1 - Sep 27th, 2007, 12:58am
 
You just need to remove the ; at the end of your "void draw();" line.
Re: void draw ()  - must contain a method body?
Reply #2 - Sep 27th, 2007, 1:02am
 
thanks...
now image  (polarfleece,0,0); is saying null pointer exception?
Re: void draw ()  - must contain a method bod
Reply #3 - Sep 27th, 2007, 1:11am
 
in setup, loadImage("polarfleece.JPG"); needs to be polarfleece=loadImage("polarfleece.JPG");

Re: void draw ()  - must contain a method body?
Reply #4 - Sep 27th, 2007, 1:13am
 
Thanks for your help... i think i may finally be getting somewhere!
Page Index Toggle Pages: 1