当前位置: 首页>>代码示例>>Java>>正文


Java GridPane.setPrefHeight方法代码示例

本文整理汇总了Java中javafx.scene.layout.GridPane.setPrefHeight方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setPrefHeight方法的具体用法?Java GridPane.setPrefHeight怎么用?Java GridPane.setPrefHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.setPrefHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
  }
 
开发者ID:kacshuffle,项目名称:SokobanGame,代码行数:33,代码来源:ViewController.java

示例2: setupConnectedPane

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public void setupConnectedPane() {
	connectedPlayerTable = new PlayerListTable(connectedPlayersList);
	dcPlayerTable = new PlayerListTable(dcPlayersList);

	connectedPane = new VBox();

	GridPane playersPane = new GridPane();
	playersPane.setPadding(new Insets(10, 0, 10, 0));

	VBox connectePlayersdPane = new VBox();
	VBox dcPlayersPane = new VBox();

	connectePlayersdPane.setPadding(new Insets(0, 5, 0, 0));
	dcPlayersPane.setPadding(new Insets(0, 0, 0, 5));

	Label connectedPlayerLabel = new Label("Connected players");
	connectedPlayerLabel.setPadding(new Insets(0, 0, 5, 0));
	Label dcPlayerLabel = new Label("Disconnected players");
	dcPlayerLabel.setPadding(new Insets(0, 0, 5, 0));



	connectePlayersdPane.getChildren().addAll(connectedPlayerLabel, connectedPlayerTable);
	dcPlayersPane.getChildren().addAll(dcPlayerLabel, dcPlayerTable);

	// Col and row length
	ColumnConstraints column1 = new ColumnConstraints();
	column1.setPercentWidth(50);
	ColumnConstraints column2 = new ColumnConstraints();
	column2.setPercentWidth(50);
	RowConstraints row = new RowConstraints();
	row.setPercentHeight(100);

	playersPane.getColumnConstraints().addAll(column1, column2);
	playersPane.getRowConstraints().add(row);

	playersPane.add(connectePlayersdPane, 0, 0);
	playersPane.add(dcPlayersPane, 1, 0);

	serverInfo = new ServerInfoPane(server);
	controlsPane = new Controls(this);

	connectedPane.setPadding(new Insets(0, 10, 0, 10));
	controlsPane.setPadding(new Insets(0, 0, 10, 0));


	serverInfo.setMinHeight(65);
	serverInfo.setMaxHeight(65);

	controlsPane.setMinHeight(200);
	controlsPane.setMaxHeight(200);

	playersPane.setPrefHeight(1000000);

	connectedPane.getChildren().add(serverInfo);
	connectedPane.getChildren().add(new Separator(Orientation.HORIZONTAL));
	connectedPane.getChildren().add(playersPane);
	connectedPane.getChildren().add(new Separator(Orientation.HORIZONTAL));
	connectedPane.getChildren().addAll(controlsPane);


}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:63,代码来源:ServerTab.java

示例3: setRightBlock

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public VBox setRightBlock(){
	VBox jobb = new VBox(10);
	jobb.setSpacing(10);
    jobb.setPrefWidth(200);
    jobb.setPrefHeight(500);

    jobb.setLayoutX(WIDTH-200);
    Button gomb = new Button("Játék újrakezdése");
    gomb.setPrefWidth(150);
    gomb.setPadding(new Insets(10, 10, 10, 10));
    gomb.setTranslateX((jobb.getPrefWidth()-gomb.getPrefWidth())/2);
    gomb.setTranslateY(50);
    jobb.setStyle("-fx-background-color: #c2c2d6;");
    jobb.getChildren().add(gomb);
    
    Text manualTitle = new Text("Irányítás:");
    manualTitle.setTranslateX(50);
    manualTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    manualTitle.setTranslateY(100);
    jobb.getChildren().add(manualTitle);
    
    GridPane moveHolder = new GridPane();
    moveHolder.setAlignment(Pos.CENTER);
    moveHolder.setHgap(10);
    moveHolder.setVgap(10);
    moveHolder.setPrefWidth(200);
    moveHolder.setPrefHeight(400);
    
    Text moveUp = new Text("↑ - Felfele lépés");
    moveUp.setTextAlignment(TextAlignment.CENTER);
    moveUp.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveUp, 0, 0, 2, 1);
    
    Text moveDown = new Text("↓ - Lefele lépés");
    moveDown.setTextAlignment(TextAlignment.CENTER);
    moveDown.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveDown, 0, 1, 2, 1);
    
    Text moveLeft = new Text("← - Balra lépés");
    moveLeft.setTextAlignment(TextAlignment.CENTER);
    moveLeft.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveLeft, 0, 2, 2, 1);
    
    Text moveRight = new Text("→ - Jobbra lépés");
    moveRight.setTextAlignment(TextAlignment.CENTER);
    moveRight.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    moveHolder.add(moveRight, 0, 3, 2, 1);
    
    jobb.getChildren().add(moveHolder);
    
    gomb.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent e) {
        	playGround.lepes = 0;
        	playGround.celban = 0;
        	playGround.getDatum(); 

        	playGround.resetPlayGround();
        	
            updatePlayGround();
            
            playGround.nyertes = 0;
            playGround.kezdes = 1;
            
            
                         
        }
    });
    
    return jobb;
}
 
开发者ID:kacshuffle,项目名称:SokobanGame,代码行数:71,代码来源:ViewController.java

示例4: 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;
  }
 
开发者ID:kacshuffle,项目名称:SokobanGame,代码行数:42,代码来源:ViewController.java


注:本文中的javafx.scene.layout.GridPane.setPrefHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。