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 › Static method is invalid, because it is enclosed..
Page Index Toggle Pages: 1
Static method is invalid, because it is enclosed.. (Read 333 times)
Static method is invalid, because it is enclosed..
Apr 16th, 2008, 10:37pm
 
Hi folks !

I'm quite new to processing, I've played with it for some time and like it very much. I also had some experiences with Java before (without framework).

Now I'm encountering the following problem : I can't define static variables ?! It tells me "The static method "blabla" is invalid, because it is enclosed in an inner class, ..." as I try to compile.

How can I make a unenclosed class ?

Thanks for your help !

Re: Static method is invalid, because it is enclos
Reply #1 - Apr 16th, 2008, 11:44pm
 
Everything in processing is normally enclosed in a PApplet class behind the scenes, to make everything work.

If you really need to define a static method, you need to create a new tab, and end the name with ".java" this makes processing not wrap the contents of that tab into the PApplet class it creates. Unfortunately the tradeoff is that things in that tab can't use normal processing functions, as they're then not built into the PApplet at the end.
Re: Static method is invalid, because it is enclos
Reply #2 - Apr 17th, 2008, 7:16pm
 
Ok, i didn't know that, thanks !!
Page Index Toggle Pages: 1