I'm having a bit of trouble using Java Swing, Eclipse, and two PApplets in Swing JFrames. Wondering if anybody can help me out... I've attached some pseudocode below that I think covers all the bases.
Basically, via its constructor, the second class PApplet Bar receives a copy of the first class PApplet Foo. The code compiles fine, all imports work OK, the JFrames render correctly, and Eclipse doesn't complain.
Bar can see Foo; the first println statement in Bar's draw() matches the corresponding println in Foo's draw(); both have the same output. The getNumber() method works perfectly in Foo. However, when Bar attempts to access foo.getNumber(), Eclipse throws a null pointer exception.
All methods are public. I've tried accessing static variables and loads of other stuff, but nothing seems to get Bar to see inside Foo.
Thanks, I'd appreciate any help or ideas. I'm at my wits end, and have tried everything I can think of.