コード例 #1
0
  public void createWallLine(int y) {
    PositionButton button;
    Pane wallRec;

    for (int x = 0; x < 8; x++) {
      wallRec = new Pane();
      wallRec.setPrefSize(30, 10);
      wallRec.setId("wallRec");

      horizontalWalls[x][y] = wallRec;
      gameGrid.setConstraints(horizontalWalls[x][y], column, row);
      gameGrid.getChildren().add(horizontalWalls[x][y]);

      column++;

      button = new WallPositionButton(new Position(x, y));
      button.setPrefSize(10, 10);
      button.setId("wallPosBtn");

      wallPositionButtons[x][y] = button;

      gameGrid.setConstraints(wallPositionButtons[x][y], column, row);
      gameGrid.getChildren().addAll(wallPositionButtons[x][y]);

      column++;
    }

    wallRec = new Pane();
    wallRec.setPrefSize(30, 10);
    wallRec.setId("wallRec");

    horizontalWalls[8][y] = wallRec;
    gameGrid.setConstraints(horizontalWalls[8][y], column, row);
    gameGrid.getChildren().add(horizontalWalls[8][y]);

    column = 0;
    row++;
  }
コード例 #2
0
  public void createMoveLine(int y) {
    PositionButton button;
    Pane wallRec;

    button = new PlayerPositionButton(new Position(0, y));
    button.setPrefSize(60, 60);
    button.setId("board");

    playerPositionButtons[0][y] = button;
    gameGrid.setConstraints(button, column, row);
    gameGrid.getChildren().addAll(playerPositionButtons[0][y]);

    for (int x = 1; x < 9; x++) {
      column++;

      wallRec = new Pane();
      wallRec.setPrefSize(10, 30);
      wallRec.setId("wallRec");

      verticalWalls[x][y] = wallRec;
      gameGrid.setConstraints(wallRec, column, row);
      gameGrid.getChildren().add(verticalWalls[x][y]);

      column++;

      button = new PlayerPositionButton(new Position(x, y));
      button.setPrefSize(60, 60);

      button.setId("board");

      playerPositionButtons[x][y] = button;
      gameGrid.setConstraints(button, column, row);
      gameGrid.getChildren().addAll(playerPositionButtons[x][y]);
    }
    column = 0;
    row++;
  }