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 › method assignment
Page Index Toggle Pages: 1
method assignment (Read 779 times)
method assignment
Apr 20th, 2010, 8:11am
 
hey folks

sorry for that question but i'm still pretty new to java/processing.
i wrote a little button class (mouseOver and mouseDown effects work properly) and then i wanted to tell an empty method "void action()" what the buttons shall do when they are clicked.

i thought method assignment as in C# would be capable for this purpose. as a matter of fact i couldn't find any way to do that.

<object.method += anotherMethod;> apparently doesn't work.  Cry

is there a chance for the noob i am to realize that or does method assignment really not exist in java/processing?

any comments and suggestions are welcome Smiley
thanks in advance!

Killian
Re: method assignment
Reply #1 - Apr 20th, 2010, 9:11am
 
Java, hence Processing, isn't functional at all (yet?).
So the only way to pass around methods is to pass around classes around them...
Might be a bit silly, as in Java we often create anonymous classes defining only one method that handle an event... But well, that's the way it is.
Re: method assignment
Reply #2 - Apr 20th, 2010, 3:59pm
 
right, it does sound kinda silly  Roll Eyes
but as long as java puts it that way i'll try to come along with it.

thanks again, this really helped!
Page Index Toggle Pages: 1