Actually that’s the tricky part to instantiate an inner class!
B/c even before instantiating an inner class, an instance of its enclosing class needs to exist 1st.
In our case, the enclosing class instance is the sketch itself, a subclass of PApplet.
1 Like
There’s a small bug in your posterity solution:
B/c variable innerCls isn’t initialized right way, that’ll never happen if the try {}
fails!
You can replace System.err.println(ex);
w/ throw new RuntimeException(ex);
inside the catch () {}
block in order to override that.
1 Like