Not sure why I'm getting a NullPointerException when creating a Swing component
- by Alex
The error occurs when creating the Box object.
public void drawBoard(Board board){
for(int row = 0; row < 8; row++){
for(int col = 0; col < 8; col++){
Box box = new Box(board.getSquare(col, row).getColour(), col, row);
squarePanel[col][row].add(box);
}
}
Board is given from the Game…