I declare an 6 arrays of JCheckBox each has 6 elements
JCheckBox[] pre = new JCheckBox[6];
JCheckBox[] expr = new JCheckBox[6];
JCheckBox[] mot = new JCheckBox[6];
JCheckBox[] res = new JCheckBox[6];
JCheckBox[] dyn = new JCheckBox[6];
JCheckBox[] appr = new JCheckBox[6];
I am tying to use a FOR loop to fill the setText property
And I am getting this errors could u please explain to me why this is happennig note that it compiles ok my checkboxes are in a 2nd frame so when i click my button to show the frame where the checkboxes are it shows me this:Code:for (int i=0 ; i<6 ; i++){ pre[i].setText(""+i);----------<< error pointing to this line expr[i].setText(""+i); mot[i].setText(""+i); res[i].setText(""+i); dyn[i].setText(""+i); appr[i].setText(""+i); }
Errors
java.lang.NullPointerException
at ccld_final.pnCcld.jbInit(pnCcld.java:109)




Reply With Quote