I have my buttons created from my Design View in Netbeans (of type JToggleButton)
ex. btn00, btn01 …
I have one matrix for my grid (Memory game style):
int matriz[][] = new int [4][6];
I have another matrix for where my images are (of type ImageIcon) and I use this method to go through it:
public ImageIcon[] ArrayIconos()
{
ImageIcon Disney[] = new ImageIcon[25];
for (int n=0; n<25; n++)
{
Disney[n] = new ImageIcon("Disney"+(n+1)+".png");
System.out.println(Disney[n]);
}
return Disney;
}
How could I feed my image matrix (Disney) into my matrix called matriz so I can load the images to the buttons?
Thanks for your help in advanced. Please let me know if my explanation is not clear enough.
Note that a memory game doesn’t need to know that the cells are arranged in a rectangular matrix; it only cares if two cells have matching images. This example uses two instances of
List<GameButton>buttonsholds all of the memory cells.selectedrecords the current selection(s).