A basic question on accessing one variable from different classes in Eclipse/ JAVA.
in
Integration and Hardware
•
1 year ago
Hi all,
While "migrating" my code from PDE to Eclipse, I came across what I am afraid this is a Java fundamental, but despite my best effrorts, I can't figure it out;
Here is what I am trying to do :
In my main class, I capture a mouse click into a Boolean:
public class MyProcessingSketch extends PApplet ()
public boolean mouseClickedHere ;
…
public void setup () {
mouseClickedHere =true
...
Public class shapeShow () ;
If (mouseClikedHere) … etc…
Well, that works in PDE (because classes beeing "inner", I suppose?) , but not in Java (I thought that "public" was supposed to do that...).
I know that I could pass the variable as a parameter, but I have tons of those, so it consider it totally unpractical (and ugly). Is there another solution ?
thanks,
1