Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

java - Lambda表达式(内部类)无法写入整数数组(Lambda expression (inner class) cannot write to integer array)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...