It is possible to pass more that one image in the constructor:
= new YourConstructor(image1, image2, image3, image4, image5); // pass 5 images to the constructor
Type: Posts; User: Norm
It is possible to pass more that one image in the constructor:
= new YourConstructor(image1, image2, image3, image4, image5); // pass 5 images to the constructor
Load the images one time and pass the references to the images in the constructor:
ImageIcon xC = new ImageIcon("asd.png"); // load icon one time here
...
for(int i=0; i < array.length; i++ )...
What did you change? It looks like the same code that has the problem.
Add a println() statement next to those statements and see how many times it prints on the console.
The images only need to be read one time. Then they can be passed to the MatrixButtons class in its constructor and saved in the class.
How many hundreds of times are the ImageIcons being loaded now?
What was the code that got the error?
When working with arrays, there are several steps needed:
1) define the variable
2) assign to the variable an array of slots to hold values
3) assign a...
That is up to the programmer to decide what value to put into a variable. What are those variables supposed to hold? When you know that, then you will know what to assign to them.
This line from...
What variable on line 40 has the null value? Find the variable and then backtrack to find out why it does not have a valid value.