I've declared
this in Java:
private
JToggleButton[]
zarObj;
Then on the
class constructor filled the
array:
this.zarObj =
new JToggleButton[]{zar1, zar2, zar3, zar4,
zar5};
I need to use
zarObj[i] to apply the setIcon method like so in a for
loop:
zarObj[i].setIcon(var);
But
I'm getting the nullPointerException. And when trying to access the
objects:
for (int i=0; i<5; i++) {
I get 5 null messages in the
System.out.println(zarObj[i]);
console.
No comments:
Post a Comment