I'm writing a small GUI program for playing Chess. I have stumbled upon the problem that I can't add any elements to chessTable without the program returning an InvocationTargetExcepetion. Here is my code:
public void start(Stage primaryStage) throws Exception {
GridPane chessTable = new GridPane();
chessTable.getStylesheets().add(getClass().getResource("styles.css").toString());
Box chessBox = new Box(112 , 94, 0);
chessBox.getStyleClass().add("chess-box");
for (int h = 0; h < 8; h++) {
for (int w = 0; w < 8; w++) {
GridPane.setConstraints(chessBox, w, h);
chessTable.getChildren().add(chessBox);
}
}
primaryStage.setTitle("ChessGame");
primaryStage.setFullScreen(true);
Scene scene = new Scene(chessTable, 900, 750);
primaryStage.setScene(scene);
primaryStage.show();
}