for(int i =0; i<8;i++){
for(int j =0; j<8;j++){
Ratsuk.getNewtablero().getMesa(i,j).setBackground(matrizcolor[i][j]);
if (Ratsuk.getNewtablero().getMesa(i,j).getBackground()==Color.lightGray);
Ratsuk.getNewtablero().getMesa(i,j).setEnabled(false);
}
}
Ratsuk.getNewtablero().getMesa(i,j)
用于调用 newtablero 内部的 JButton 2d 数组,而 matrizcolor 是相同大小的颜色的 2d 数组。
当它运行时,该阵列中的所有按钮都被禁用,不仅是浅灰色的。任何1可以解释我为什么?