I am trying to set a checkbox to being selected if it finds the word "true" at a particular point in an array called saved_mat.
System.out.println(saved_mat[0][15]);
if(saved_mat[0][15].equals("true")){
e1_10e.setSelected(true);
}
The first line prints out "true" as expected, but I get a null pointer exception on the third line. The array is of size [30][24] and the first line confirms that there is something in the [0][15] element of the array. The e1_10e is defined as a JCheckbox. I am not sure how I could be getting a null pointer exception on the third line. Any help would be appreciated.
JCheckBox e1_10e = new JCheckBox("");
e1_10e.setBounds(32, 152, 21, 23);
jp1.add(e1_10e);
This is the code that was generated by the GUI editor to create the JCheckbox. I used this same editor for several JTextFields and was able to reference them in my code with no problem.