public void updateBoard() {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
Piece piece = game.getBoard().getPiece(i, j);
if (piece != null) {
String name = piece.getName();
boolean isWhite = piece.isWhite();
String color = (isWhite) ? "white" : "black";
ImageIcon icon = new ImageIcon(
getClass().getResource("/resources/pieces/" + color + name + ".png"));
System.out.println("Image load status: " + icon.getImageLoadStatus());
if (icon.getImageLoadStatus() != MediaTracker.COMPLETE) {
System.out.println("Failed to load image for " + color + " " + name);
}
boardButtons[i][j].setIcon(icon);
} else {
boardButtons[i][j].setIcon(null);
}
}
}
}
I am trying to display a chess board but when I attempt to load icons onto the chess board it doesnt display anything, the console is completely empty, no errors no system messages. Why could this be happening? I have check 100 times to make sure the file names are correct.