I doubt Class::getDeclaredMethod() is able to find methods that a class inherited from any of its parents:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getDeclaredMethod(java.lang.String,java.lang.Class...)
Instead, method colorCalc() is found declared inside class PGraphics:
And not in any of its subclasses:
Therefore, you’re gonna need to use PGraphics.class
in place of g.getClass()
.