0
我綁定Tile Property
以使HomeTabCell
動態調整它們的寬度和高度值。但HomeTabCell
的寬度和高度保持不變。調整TilePane單元的大小
這是一種使它工作的方法,還是應該使用GridPane
來代替?
for (int i = 0; i < room.getMaxPlayers(); i++) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/HomeTabCell.fxml"));
tilePane.getChildren().add(fxmlLoader.load());
tilePane.prefTileWidthProperty().bind(centerRoomHBox.widthProperty().divide(2).subtract(3));
tilePane.prefTileHeightProperty().bind(centerRoomHBox.heightProperty().divide(6/2));
HomeTabCell box = (HomeTabCell) fxmlLoader.getController();
box.setInfo(null, room.getMaxPlayers());
} catch (IOException ex) {
bugsnag.notify(ex);
}
}