當前位置: 首頁>>代碼示例>>Java>>正文


Java GridPane.setPrefWidth方法代碼示例

本文整理匯總了Java中javafx.scene.layout.GridPane.setPrefWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java GridPane.setPrefWidth方法的具體用法?Java GridPane.setPrefWidth怎麽用?Java GridPane.setPrefWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.setPrefWidth方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createBody

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
 * Creates the node used for the body part of each cell.
 *
 * In this default implementation the body consists of a grid pane with
 * three columns. The middle column is used for showing the title of
 * calendar entries. This column will get whatever space is left after
 * the icon and the time column have used what they need. This means
 * that a very long title will automatically be truncated.
 *
 * @return the body node
 */
protected Node createBody() {
    // icon column
    ColumnConstraints iconColumn = new ColumnConstraints();

    // title column
    ColumnConstraints descriptionColumn = new ColumnConstraints();
    descriptionColumn.setFillWidth(true);
    descriptionColumn.setHgrow(Priority.SOMETIMES);
    descriptionColumn.setMinWidth(0);
    descriptionColumn.setPrefWidth(0);

    // time column
    ColumnConstraints timeColumn = new ColumnConstraints();
    timeColumn.setHalignment(HPos.RIGHT);

    gridPane = new GridPane();
    gridPane.setGridLinesVisible(true);
    gridPane.setMinWidth(0);
    gridPane.setPrefWidth(0);
    gridPane.getStyleClass().add(AGENDA_VIEW_BODY);
    gridPane.getColumnConstraints().addAll(iconColumn, descriptionColumn, timeColumn);

    return gridPane;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:36,代碼來源:AgendaView.java

示例2: 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

示例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.setPrefWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。