最后一个 for 循环将编译但不会运行。它说数组索引超出范围异常:17。我只想在第 17 行的 1-8 列中添加一个 ColorRectangles(ColorShape 的子类)
private ColorShape[][] _tiles;
public GamePanel()
{
_tiles = new ColorShape[8][17];
for (int i = 0; i<16; i++){
for(int j=0; j<8;j++){
_tiles[j][i] = null;
}
}
for (int j=0; j<8;j++){
_tiles[j][17] = new ColorRectangle(Color.BLACK);
}
}