I'm not sure why that is, but my code seems to require the definition of size when I declare my arrays in this case.
the lines
- int[] BoxX;
- int[] BoxY;
simply state that you want to make use of 2 integer arrays but it does
not create them, so at this stage BoxX and BoxY hold the value
null. Attempting to use BoxX and BoxY will cause the NullPointerException, which is what happened.
The lines
- int[] BoxX = new int[20];
- int[] BoxY = new int[20];
also
create the arrays so they can be used.
So in your code above lines 15-17 caused the NPE because the arrays didn't exist.
Additional information about error messages.G4P (the library) uses a special technique called reflection so that when you click on a button it executes a method called
handleButtonEvents. If an exception occurs in any code excuted inside this method or any other method called by this method (such as
loadTemplateData) then G4P catches this exception and reports the error e.g.
############# EXCEPTION IN EVENT HANDLER #############
An error occured during execution of the eventhandler:
CLASS: JupiterShowDemo_v6_G4P_b METHOD: handleButtonEvents
Caused by java.lang.NullPointerException
JupiterShowDemo_v6_G4P_b.loadTemplateData(JupiterShowDemo_v6_G4P_b.java:608)
########################################################This identifies the
class and method where the exception occured. This is much more informative than the messaage you would have got if the library allowed the Java reflection classes to handle the exception instead.
PS this post was caught by Zoho's anti spammer - can't see why! It makes you wonder about the skill of Zoho's programmers if they can't create more sophisticated software especially when you see some of the spam posts that slip through. You will get to see this when a moderator clears it.
