for(int u = 0; u < 9; u++) {
/*int i2 = i;
int finalI = i;*/
int u2 = u;
button[u2].setOnMouseClicked(event -> {
MouseButton mbutton = event.getButton();
if (mbutton == MouseButton.PRIMARY) {
//grid_b[i[0]] = false;
//grid[u[0]] = 0;
//arraylist.add(u2, 0);
button[u2].setText("O");
int qdq;
} else if (mbutton == MouseButton.SECONDARY) {
//grid_b[i[0]] = true;
//arraylist.add(u2, 1);
//grid[u[0]] = 1;
button[u2].setText("X");
} else if (mbutton == MouseButton.MIDDLE) {
primaryStage.setTitle(String.valueOf(grid[u2]));
e[0] = false;
}
});
This is my code, I want to make a TicTacToe game from scratch in JavaFX.
(这是我的代码,我想用JavaFX从零开始制作一个TicTacToe游戏。)
As you can see I tried everything, but I can't get those arrays updated (如您所见,我尝试了所有操作,但无法更新这些数组)
ask by user6070761 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…