We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I use Eclipse and have a main function which calls 2 different PApplets:
public static void main(String... args){
PApplet.main("Backend.LaunchBackend");
PApplet.main("Interface.LaunchInterface");
}
Inside Backend, I have several classes which reference to LaunchBackend and are constructed via SomeClass(PApplet parent).
Class SomeClass{
LaunchBackend parent;
public SomeClass(LaunchBackend parent){
this.parent = parent;
}
While coding from within the LaunchBackend PApplet, I can obviously instanciate these via:
SomeClass someClass = new SomeClass(this);
But what if I want to instanciate the class not from within the LaunchBackend PApplet, but from within the LaunchInterface PApplet? I still want the instance of the object to point to LaunchBackend as its parent, like this:
Within Interface:
SomeClass someClass = new SomeClass(***reference to the LaunchBackend PApplet instance***);
Answers
I assume that
Backend
andInterface
are package names. If they are then in Java package names start with a lowercase letter. Hence my assumption.I have not tested this but I think it should work.