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


Java GridPane.setStyle方法代碼示例

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


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

示例1: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override
public void start(final Stage primaryStage) {
    GridPane gridPane = new GridPane();
    gridPane.setStyle("-fx-background-color: #252525");
    gridPane.setHgap(5.0);
    gridPane.setGridLinesVisible(true);

    gridPane.add(new AnchorPane(new Alarm()),       0, 0);
    gridPane.add(new AnchorPane(new Display()),     1, 0);
    gridPane.add(new AnchorPane(new Generator()),   2, 0);
    gridPane.add(new AnchorPane(new LevelBar()),    3, 0);
    gridPane.add(new AnchorPane(new Load()),        4, 0);
    gridPane.add(new AnchorPane(new Switch()),      5, 0);
    gridPane.add(new AnchorPane(new Transformer()), 6, 0);

    Scene scene = new Scene(gridPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
開發者ID:assemblits,項目名稱:dynamo,代碼行數:20,代碼來源:DynamoTest.java

示例2: buildScreenPane

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private GridPane buildScreenPane( final Iterable<Object> buildsInScreen, final int nbColums, final int byColums ) {
    final GridPane screenPane = new GridPane( );
    screenPane.setHgap( GAP_SPACE );
    screenPane.setVgap( GAP_SPACE );
    screenPane.setPadding( new Insets( GAP_SPACE ) );
    screenPane.setStyle( "-fx-background-color:black;" );
    screenPane.setAlignment( Pos.CENTER );

    final Iterable<List<Object>> partition = Iterables.paddedPartition( buildsInScreen, byColums );
    for ( int x = 0; x < nbColums; x++ ) {
        final List<Object> buildList = x < size( partition ) ? Iterables.get( partition, x ) : Collections.emptyList( );
        for ( int y = 0; y < byColums; y++ ) {
            if ( buildList.isEmpty( ) ) {
                createEmptyTile( screenPane, x, y, nbColums, byColums );
                continue;
            }

            final Object build = Iterables.get( buildList, y );
            if ( build == null )
                createEmptyTile( screenPane, x, y, nbColums, byColums );
            else
                createTileFromModel( screenPane, build, x, y, nbColums, byColums );
        }
    }

    return screenPane;
}
 
開發者ID:u2032,項目名稱:wall-t,代碼行數:28,代碼來源:WallView.java

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

示例4: applyDefaultGridSetup

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public static void applyDefaultGridSetup(GridPane grid) {
    grid.setStyle("-fx-padding: 10px; -fx-spacing: 10px; -fx-hgap: 10px;-fx-vgap: 10px");
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:4,代碼來源:Utils.java

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

示例6: SpielFeld

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
 * Konstruktormethode zur Einrichtung des Spielfeldes.
 */

public SpielFeld() {
    // spiel enthaelt die Spiellogik
    spiel = new Spiel(this);

    // Arrays fuer Auswahl-Buttons und die Spielsteine
    button = new Button[7];
    field = new Label[42];

    // Bilder fuer Auswahl-Button, Spieler1, Spieler2 und "leere Steine"
    user = new Image("user.gif");
    red = new Image("red.gif");
    green = new Image("green.gif");
    gray = new Image("grau.gif");

    // Spieler1 ist rot, Spieler2 gruen
    ROT = 1;
    GRUEN = 2;


    // Initialisierung des Labels am oberen Rand
    display = new Label("Rot beginnt!");
    labelBox = new HBox(display);
    labelBox.setAlignment(Pos.CENTER);
    labelBox.setStyle("-fx-background-color: red;");
    this.setTop(labelBox);

    // Initialisierung des Spielfeldes in der Mitte
    gridPanel = new GridPane();
    gridPanel.setAlignment(Pos.CENTER);
    gridPanel.setStyle("-fx-background-color: black;");
    gridPanel.setPadding(new Insets(3));
    // Hinzufuegen der Auswahlknoepfe mit Event-Handlern
    for (int i = 0; i < 7; i++) {
        button[i] = new Button("", new ImageView(user));
        button[i].setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        button[i].addEventHandler(ActionEvent.ACTION, e -> spiel.waehleSpalte(e));
        gridPanel.add(button[i], i, 0);
    }
    // Hinzufuegen der "Spielsteine"
    for (int i = 0; i < 42; i++) {
        field[i] = new Label("", new ImageView(gray));
        field[i].setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        field[i].setStyle("-fx-border-color: white;");
        gridPanel.add(field[i], i % 7, i / 7 + 1);
    }
    this.setCenter(gridPanel);

    // Initialisierung der "Menue-Buttons" am unteren Rand
    buttonBox = new HBox(20);
    buttonBox.setAlignment(Pos.CENTER);
    buttonBox.setPadding(new Insets(5));
    neuesSpiel = new Button("Neues Spiel");
    neuesSpiel.addEventHandler(ActionEvent.ACTION, e -> spiel.clean());
    hilfe = new Button("Hilfe");
    hilfe.addEventHandler(ActionEvent.ACTION, e -> new HilfeDialog().showAndWait());
    buttonBox.getChildren().addAll(neuesSpiel, hilfe);
    this.setBottom(buttonBox);
}
 
開發者ID:CAPTNCAPS,項目名稱:java.IF17wi,代碼行數:63,代碼來源:SpielFeld.java


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