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 › confusion about java mode
Page Index Toggle Pages: 1
confusion about java mode (Read 578 times)
confusion about java mode
May 19th, 2007, 10:02pm
 
I've started working in Eclipse, since this is what I'm used to, and it has some nice features, and so on...

Anyway, I've got the hang of the examples on the "Learning" page, and it's all going well. However, moving into java mode and eclipse, I'm finding it kind of confusing figuring out how to deal with multiple classes, in multiple files. My problem is this: in the Processing-based examples, inner classes handle the draw()ing of their own data and the outer "main" class (not really "main", but you know what I mean) just tells them when to do it. But I can't get it to work like this when using separate classes - it doesn't seem like they're able to draw themselves... I just get errors. This seems sort of reasonable, since the main class is the one the applet's running from, so it's the one that owns the window, in a sense. But what's the general practice when working with multiple classes like this, outside of Processing? I've got working by having my external class return the necessary drawing data to the main class, but it's really kind of awkward. Nowhere near as elegant as the examples.

Any help very much appreciated. Maybe I've just got something set up strangely. It certainly seems as though I should just be able to tell an external class to draw() itself, but maybe I'm missing something.

J.
Re: confusion about java mode
Reply #1 - May 19th, 2007, 10:28pm
 
...oops, damn!

Sorry folks, found the tutorial from toxi (that guy's really helpful, isn't he?) - passing the PApplet does the trick. Sweet!

J.
Page Index Toggle Pages: 1