本文整理汇总了Java中javafx.scene.layout.GridPane.setLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setLayoutY方法的具体用法?Java GridPane.setLayoutY怎么用?Java GridPane.setLayoutY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setLayoutY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEndingScreen
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public GridPane setEndingScreen(){
GridPane endGrid = new GridPane();
endGrid.setAlignment(Pos.CENTER);
endGrid.setHgap(10);
endGrid.setVgap(10);
endGrid.setPrefWidth(300);
endGrid.setPrefHeight(150);
endGrid.setLayoutX((WIDTH-200)/2 - endGrid.getPrefWidth()/2);
endGrid.setLayoutY(HEIGHT/2 - endGrid.getPrefHeight()/2);
endGrid.setPadding(new Insets(25, 25, 25, 25));
endGrid.setStyle("-fx-background-color: #C0C0C0;");
Text scenetitle = new Text("Gratulálok, nyertél!\n\n Lépéseid száma: " + playGround.lepes);
scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
scenetitle.setTextAlignment(TextAlignment.CENTER);
endGrid.add(scenetitle, 0, 0, 2, 1);
Button btn = new Button("Hozzáadás a toplistához");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_CENTER);
hbBtn.getChildren().add(btn);
endGrid.add(hbBtn, 1, 4);
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
PlayerImp.AddToHighScore(playGround.celban,playGround.lepes,playGround.datum, playGround.jatekosneve);
endGrid.setVisible(false);
}
});
return endGrid;
}
示例2: setWelcomeScreen
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public GridPane setWelcomeScreen(){
GridPane welcomeGrid = new GridPane();
welcomeGrid.setAlignment(Pos.CENTER);
welcomeGrid.setHgap(10);
welcomeGrid.setVgap(10);
welcomeGrid.setPrefWidth(300);
welcomeGrid.setPrefHeight(150);
welcomeGrid.setLayoutX((WIDTH-200)/2 - welcomeGrid.getPrefWidth()/2);
welcomeGrid.setLayoutY(HEIGHT/2 - welcomeGrid.getPrefHeight()/2);
welcomeGrid.setPadding(new Insets(25, 25, 25, 25));
welcomeGrid.setStyle("-fx-background-color: #C0C0C0;");
Text welcomeScreenTitle = new Text("Üdvözöllek, \n kérlek írd be a beceneved.");
welcomeScreenTitle.setTextAlignment(TextAlignment.CENTER);
welcomeScreenTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
welcomeGrid.add(welcomeScreenTitle, 0, 0, 2, 1);
Label nickName = new Label("Becenév:");
welcomeGrid.add(nickName, 0, 1);
TextField nickNameTextField = new TextField();
welcomeGrid.add(nickNameTextField, 1, 1);
Button startButton = new Button("Játék kezdése");
HBox btnHolder = new HBox(10);
btnHolder.setAlignment(Pos.BOTTOM_RIGHT);
btnHolder.getChildren().add(startButton);
welcomeGrid.add(btnHolder, 1, 4);
startButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
playGround.jatekosneve = nickNameTextField.getText();
playGround.kezdes = 1;
welcomeGrid.setVisible(false);
}
});
return welcomeGrid;
}