记忆游戏 - 喂养的图像阵列到网格按钮矩阵 [英] Memory Game - Feeding an image array to a grid button matrix
问题描述
我从设计视图在Netbeans的(类型JToggleButton中的)创建我的按钮
I have my buttons created from my Design View in Netbeans (of type JToggleButton)
恩。 btn00,btn01 ...
ex. btn00, btn01 ...
我有一个矩阵为我网格(记忆游戏风格):
I have one matrix for my grid (Memory game style):
INT matriz [] [] =新INT [4] [6];
int matriz[][] = new int [4][6];
我有我的图像(类型的ImageIcon),其中另一个矩阵,我用这个方法来通过它:
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;
}
我怎么能养活我的图像矩阵(迪士尼)到我的矩阵称为matriz,所以我可以加载图像按钮?
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.
推荐答案
请注意,一个存储器游戏不需要知道该单元被布置在矩形矩阵;如果两个细胞有匹配的图像只在乎。这例如使用名单,LT的两个实例; GameButton&GT;
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>
-
按钮
保存所有的存储单元。 -
选
记录当前的选择(S)。
buttons
holds all of the memory cells.selected
records the current selection(s).
这篇关于记忆游戏 - 喂养的图像阵列到网格按钮矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!