本文整理匯總了Java中javafx.scene.layout.HBox.setMinSize方法的典型用法代碼示例。如果您正苦於以下問題:Java HBox.setMinSize方法的具體用法?Java HBox.setMinSize怎麽用?Java HBox.setMinSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.setMinSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createGrid
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private void createGrid() {
gridOperator.traverseGrid((i,j)->{
gridGroup.getChildren().add(createCell(i, j));
return 0;
});
gridGroup.getStyleClass().add("game-grid");
gridGroup.setManaged(false);
gridGroup.setLayoutX(BORDER_WIDTH);
gridGroup.setLayoutY(BORDER_WIDTH);
HBox hBottom = new HBox();
hBottom.getStyleClass().add("game-backGrid");
hBottom.setMinSize(gridWidth, gridWidth);
hBottom.setPrefSize(gridWidth, gridWidth);
hBottom.setMaxSize(gridWidth, gridWidth);
// Clip hBottom to keep the dropshadow effects within the hBottom
Rectangle rect = new Rectangle(gridWidth, gridWidth);
hBottom.setClip(rect);
hBottom.getChildren().add(gridGroup);
vGame.getChildren().add(hBottom);
}
示例2: createScore
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private void createScore() {
Label lblTitle = new Label("fx2048");
lblTitle.getStyleClass().addAll("game-label","game-title");
Label lblSubtitle = new Label("FX");
lblSubtitle.getStyleClass().addAll("game-label","game-subtitle");
HBox hFill = new HBox();
HBox.setHgrow(hFill, Priority.ALWAYS);
hFill.setAlignment(Pos.CENTER);
VBox vScores = new VBox();
HBox hScores=new HBox(5);
vScore.setAlignment(Pos.CENTER);
vScore.getStyleClass().add("game-vbox");
Label lblTit = new Label("分數");
lblTit.getStyleClass().addAll("game-label","game-titScore");
lblScore.getStyleClass().addAll("game-label","game-score");
lblScore.textProperty().bind(gameScoreProperty.asString());
vScore.getChildren().addAll(lblTit, lblScore);
VBox vRecord = new VBox(-5);
vRecord.setAlignment(Pos.CENTER);
vRecord.getStyleClass().add("game-vbox");
Label lblTitBest = new Label("最高分");
lblTitBest.getStyleClass().addAll("game-label","game-titScore");
lblBest.getStyleClass().addAll("game-label","game-score");
lblBest.textProperty().bind(gameBestProperty.asString());
vRecord.getChildren().addAll(lblTitBest, lblBest);
hScores.getChildren().addAll(vScore,vRecord);
VBox vFill = new VBox();
VBox.setVgrow(vFill, Priority.ALWAYS);
vScores.getChildren().addAll(hScores,vFill);
hTop.getChildren().addAll(lblTitle, lblSubtitle, hFill,vScores);
hTop.setMinSize(gridWidth, TOP_HEIGHT);
hTop.setPrefSize(gridWidth, TOP_HEIGHT);
hTop.setMaxSize(gridWidth, TOP_HEIGHT);
vGame.getChildren().add(hTop);
HBox hTime=new HBox();
hTime.setMinSize(gridWidth, GAP_HEIGHT);
hTime.setAlignment(Pos.BOTTOM_RIGHT);
lblTime.getStyleClass().addAll("game-label","game-time");
lblTime.textProperty().bind(clock);
timer=new Timeline(new KeyFrame(Duration.ZERO, e->{
clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt));
}),new KeyFrame(Duration.seconds(1)));
timer.setCycleCount(Animation.INDEFINITE);
hTime.getChildren().add(lblTime);
vGame.getChildren().add(hTime);
getChildren().add(vGame);
lblPoints.getStyleClass().addAll("game-label","game-points");
lblPoints.setAlignment(Pos.CENTER);
lblPoints.setMinWidth(100);
getChildren().add(lblPoints);
}