public void buildPlayerLabels(int noLabels) { remainingWallLabels = new Label[noLabels]; for (int i = 0; i < noLabels; i++) { remainingWallLabels[i] = new Label(); remainingWallLabels[i].setId("playerLabels"); remainingWallLabels[i].setWrapText(true); remainingWallLabels[i].setAlignment(Pos.CENTER); infoPane.getChildren().addAll(remainingWallLabels[i]); } }
public BoardView(int noPlayers, final Stage primaryStage) { window = primaryStage; window.setTitle("Quoridor"); window.setMaxHeight(1280); window.setMaxWidth(1280); window.setResizable(false); BorderPane border = new BorderPane(); infoPane = new FlowPane(); infoPane.setPadding(new Insets(10)); infoPane.setHgap(40); infoPane.setVgap(10); infoPane.setOrientation(Orientation.HORIZONTAL); bottomPane = new HBox(); bottomPane.setSpacing(345); gameGrid = new GridPane(); gameGrid.setPadding(new Insets(4)); gameGrid.setId("gamegrid"); border.setTop(infoPane); border.setCenter(gameGrid); playerPositionButtons = new PlayerPositionButton[9][9]; wallPositionButtons = new WallPositionButton[9][8]; horizontalWalls = new Pane[9][9]; verticalWalls = new Pane[9][9]; column = 0; row = 0; chooseVertical = new Button(); chooseVertical.setPrefSize(100, 100); chooseVertical.setId("vWallBtn"); Button home = new Button(); home.setPrefSize(100, 100); home.setId("home"); home.setOnAction(e -> confirmBox()); bottomPane.getChildren().addAll(chooseVertical, home); border.setBottom(bottomPane); border.setMargin(bottomPane, new Insets(40, 40, 20, 20)); for (int y = 0; y < 8; y++) { createMoveLine(y); createWallLine(y); } createMoveLine(8); main = new Scene(border, 600, 768); main.getStylesheets().add("gameplay/viewJFX/" + stylesheet); buildPlayerLabels(noPlayers); window.setScene(main); window.show(); }