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


Java GridPane.setAlignment方法代码示例

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


在下文中一共展示了GridPane.setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
	GridPane pane = new GridPane();
	pane.setAlignment(Pos.CENTER);
	pane.setMaxSize(800, 600);
	pane.setPrefSize(800, 600);
	pane.setManaged(true);
	pane.setVgap(3);
	pane.setHgap(3);
	pane.addRow(1, new Label("Chess Master"));
	ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
	renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
	ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
	pane.addRow(2, new Label("Select a renderer:"), renderCombo);
	Button button = new Button("Start!");
	button.setOnAction(event -> {
		ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
		renderCombo.getSelectionModel().getSelectedItem().renderer.render();
		primaryStage.close();
	});
	pane.addRow(3, button);
	primaryStage.setScene(new Scene(pane));
	primaryStage.show();
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:25,代码来源:RenderEngineSelector.java

示例2: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    WatchDAO.addWatcher(this);
    stage = primaryStage;
    stage.setTitle(ViewConstants.PROGRAM_TITLE);
    stage.getIcons().add(fileLoad.loadImageFile(ViewConstants.PROGRAM_ICON_LOCATION));

    gridPane = new GridPane();
    gridPane.setAlignment(Pos.TOP_LEFT);
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(10, 10, 10, 10));

    Scene scene = new Scene(gridPane, ViewConstants.PROGRAM_WIDTH, ViewConstants.PROGRAM_HEIGHT);
    primaryStage.setScene(scene);
    primaryStage.show();

    gridPane.getStylesheets().add(this.getClass().getClassLoader().getResource("gui/css/weatherwatch.css")
            .toExternalForm());
    loadWeatherImages();
    addGuiElements();
    TrayApp.initialize();
}
 
开发者ID:ykarim,项目名称:WeatherWatch,代码行数:24,代码来源:WeatherPage.java

示例3: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle("Graph Space");

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);

    int HEIGHT = 10;
    for (int y = 0; y < HEIGHT; y++) {
        int WIDTH = 10;
        for (int x = 0; x < WIDTH; x++) {
            final String text = world.getNodeAt(new Point(x - WIDTH /2, y - HEIGHT /2)).readObject();

            Button newButton = new Button(text);
            newButton.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    System.out.println(text);
                }
            });

            grid.add(newButton, x, y);
        }
    }

    Scene scene = new Scene(grid);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:30,代码来源:GridGUI.java

示例4: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
  public void start(Stage primaryStage) throws Exception {

      //设置布局
      GridPane grid = new GridPane();
      grid.setAlignment(Pos.CENTER);
      grid.setHgap(10);
      grid.setVgap(10);
      grid.setPadding(new Insets(5, 5, 5, 5));
      //增加一个现实密码的Label
      Label label = new Label(StringResource.PASSWORD_MESSAGE);
      label.setFont(new Font(19));
      grid.add(label, 0, 1);
TextField textField = new TextField(Password.genRandomNum(8));
textField.setFont(new Font(19));
grid.add(textField,1,1);
      //增加一个刷新按钮
      Button button = new Button();
      button.setText(StringResource.BTN_PASSWORD_REFRESH);
      button.setOnAction(ActionEvent ->{
      		String newPassword = Password.genRandomNum(8);
      		System.out.println(StringResource.PASSWORD_MESSAGE + newPassword);
		textField.setText(newPassword);
          }
      );
      grid.add(button, 2, 1);
      Scene scene = new Scene(grid, 535, 60);
      primaryStage.setScene(scene);
      primaryStage.setTitle(TITLE);
      primaryStage.show();
  }
 
开发者ID:ddknight,项目名称:javafx-password-generator,代码行数:32,代码来源:JavaFXPasswordGenerator.java

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

示例6: initializeInputControls

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private Node initializeInputControls(){
	GridPane activatablecontrols = new GridPane();
	activatablecontrols.setAlignment(Pos.CENTER);
	activatablecontrols.setPadding(new Insets(10.0));
	activatablecontrols.setVgap(10.0);
	activatablecontrols.setHgap(10.0);
	controlsActivatable_Pane = activatablecontrols;
	
	GridPane inputcontrols = new GridPane();
	inputcontrols.setAlignment(Pos.CENTER);
	inputcontrols.setPadding(new Insets(10.0));
	inputcontrols.setVgap(10.0);
	inputcontrols.setHgap(15.0);
	controlsInput_Pane = inputcontrols;
	
	VBox estopBox = new VBox();
	estopBox.setSpacing(5.0);
	estopBox.setPadding(new Insets(10.0));
	estopBox.setAlignment(Pos.CENTER);
	estopBox.getChildren().addAll(Dashboard.getEmergencyStopControl().getRoot());
	
	SplitPane controlsPane = new SplitPane();
	controlsPane.setOrientation(Orientation.HORIZONTAL);
	controlsPane.getItems().addAll(inputcontrols, activatablecontrols);
	controlsPane.setMinSize(800.0, 150.0);
	
	BorderPane root = new BorderPane();
	root.setLeft(controlsPane);
	root.setRight(estopBox);
	return root;
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:32,代码来源:MainWindow.java

示例7: RregulloPunen

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public RregulloPunen(int id, boolean kryer, TeDhenat td){
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
    stage.setTitle("Rregullo");
    HBox btn = new HBox(5);
    btn.getChildren().addAll(btnOk, btnAnulo);
    btn.setAlignment(Pos.CENTER_RIGHT);
    GridPane grid = new GridPane();
    grid.add(cbKryer, 0, 0);
    grid.add(btn, 0, 1);
    grid.setVgap(10);
    grid.setAlignment(Pos.CENTER);

    cbKryer.setSelected(kryer);

    btnOk.setOnAction(e -> {
        azhurno(id);
        new Thread(new Runnable() {
            @Override
            public void run() {
                td.mbush();
            }
        }).start();
    });

    btnAnulo.setOnAction(e -> stage.close());

    Scene scene = new Scene(grid, 230, 100);
    scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:33,代码来源:RregulloPunen.java

示例8: constructContainer

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
	public Parent constructContainer() {
		// title settings:
		String title = Globals.appTitle + " " + Globals.appVersion;
		this.getWindow().setTitle(title);
		//debug.Debugger.out("constructing MainView Container with title '"+title+"'...");
		getFXController().getMyFXStage().setTitle(title);
		
		//Die L�ckenf�ller sind da weil eine Spalte nicht Nichts enthalten kann wegen 
		//dem Abstand. Es w�rde es einfach ignorieren. Deswegen 2 leere Labels da.
		lueckenfueller1.setMinSize(FXSettings.HoverButtonWidth,FXSettings.HoverButtonHeight);
		lueckenfueller2.setMinSize(FXSettings.HoverButtonWidth,FXSettings.HoverButtonHeight);
		//... und "Nein" man kann nicht das gleiche Label an 2 verschiedenen Stellen hinzuf�gen.
		
		GridPane gridpane = new GridPane();
		//Hier werden die Koordinaten der Komponenten bestimmt: 
	    gridpane.setAlignment(Pos.CENTER);
//		gridpane.setHgap(4);
//		gridpane.setVgap(4);
	    gridpane.add(lernenStartBtn, 3, 3);
	    gridpane.add(userLoginBtn, 6, 2);
	    gridpane.add(statisticBtn, 3, 1);  
	    gridpane.add(quitBtn, 3, 5);  
	    gridpane.add(gameBtn, 1, 4); 
	    gridpane.add(optionsBtn, 6, 4);
	    gridpane.add(helpbtn, 1, 2);
	    gridpane.add(lueckenfueller1 , 2 ,3);
	    gridpane.add(lueckenfueller2 , 5 ,3);
	    
		// special solution for the close button
		quitBtn.setOnMouseClicked(e ->
		{
			debug.Debugger.out("closing button");
			this.closeAll();
		});		
		// does the same as the close button, when closing window on x
		getWindow().setOnCloseRequest(e ->
		{
			debug.Debugger.out("closing window");
			this.closeAll();
		});
		
		//debug.Debugger.out("Set impressum...");
		return gridpane;
	}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:46,代码来源:MainView.java

示例9: ListDisplay

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public ListDisplay (ObservableList<T> list) {
    myPane = new GridPane();
    myPane.setAlignment(Pos.CENTER);
    initListView(list);

}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:7,代码来源:ListDisplay.java

示例10: mainScreen

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void mainScreen(final Stage primaryStage) {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Text scenetitle = new Text("Game Of Life");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0);

    Label heightLabel = new Label("Height:");
    grid.add(heightLabel, 0, 2);

    final TextField heightField = new TextField();
    heightField.setText(String.valueOf(fieldHeight));
    grid.add(heightField, 1, 2);

    Label widthLabel = new Label("Width:");
    grid.add(widthLabel, 0, 3);

    final TextField widthField = new TextField();
    widthField.setText(String.valueOf(fieldWidth));
    grid.add(widthField, 1, 3);

    Label cellDensityLabel = new Label("Cell density:");
    grid.add(cellDensityLabel, 0, 4);

    final Slider cellDensitySlider = new Slider();
    cellDensitySlider.setMin(0);
    cellDensitySlider.setMax(1);
    cellDensitySlider.setValue(cellDensity);
    cellDensitySlider.setShowTickLabels(true);
    cellDensitySlider.setShowTickMarks(true);
    cellDensitySlider.setMajorTickUnit(0.50);
    cellDensitySlider.setMinorTickCount(10);
    grid.add(cellDensitySlider, 1, 4);

    final Label errorLabel = new Label("");
    errorLabel.setMinSize(150, 10);
    grid.add(errorLabel, 0, 6);

    Button start = new Button("Start");
    start.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                fieldHeight = Integer.parseInt(heightField.getText());
                fieldWidth = Integer.parseInt(widthField.getText());
                cellDensity = cellDensitySlider.getValue();
                gameScreen(primaryStage);
            } catch (NumberFormatException e) {
                errorLabel.setText("Please enter an integer.");
            }
        }
    });
    grid.add(start,1,5);

    Scene scene = new Scene(grid);
    primaryStage.setScene(scene);
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:62,代码来源:Main.java

示例11: initialize

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void initialize() {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Label kidLabel = new Label("Id :");
    grid.add(kidLabel, 0, 0);

    HBox idPane = new HBox(10);
    TextField kidField = new TextField();
    kidField.textProperty().bindBidirectional(id);

    Button kidButton = new Button("id");
    kidButton.setOnAction(eventAction -> id.setValue(UUID.randomUUID().toString()));

    idPane.getChildren().addAll(kidField, kidButton);
    grid.add(idPane, 1, 0);

    Label typeLabel = new Label("Type :");
    grid.add(typeLabel, 0, 1);

    ComboBox keyTypeComboBox = new ComboBox();
    keyTypeComboBox.getItems().addAll(
            "RSA"
    );
    keyTypeComboBox.valueProperty().bindBidirectional(keyType);
    grid.add(keyTypeComboBox, 1, 1);

    Label lengthLabel = new Label("Length :");
    grid.add(lengthLabel, 0, 2);

    ComboBox keyLengthComboBox = new ComboBox();
    keyLengthComboBox.getItems().addAll(
            "2048",
            "3072",
            "4096"
    );
    keyLengthComboBox.valueProperty().bindBidirectional(keySize);
    grid.add(keyLengthComboBox, 1, 2);

    HBox buttonPane = new HBox(10);
    Button saveButton = new Button("Apply");
    saveButton.setOnAction(actionEvent -> this.createKey());

    Button cancelButton = new Button("Cancel");
    cancelButton.setOnAction(actionEvent -> new JWKView(primaryStage, rootPane, jwkSetData).initialize());

    buttonPane.getChildren().addAll(cancelButton, saveButton);

    grid.add(buttonPane, 1, 3);

    rootPane.setCenter(grid);
}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:57,代码来源:NewJWKView.java

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

示例13: ShtoPunetor

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public ShtoPunetor(DritarjaKryesore dk, String dump){
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/sample/foto/icon.png")));
    stage.setTitle("Ndrysho fjalekalimin");
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
    HBox btn = new HBox(5);
    btn.setAlignment(Pos.CENTER_RIGHT);
    btn.getChildren().addAll(btnOk, btnAnulo);
    data.setValue(LocalDate.now());

    GridPane root = new GridPane();
    root.add(new Label("Emri"), 0, 0);
    root.add(user, 1, 0);
    root.add(new Label("Fjalekalimi"), 0, 1);
    root.add(pw, 1, 1);
    root.add(shfaq, 2, 1);
    root.add(lblPw, 1, 2);
    root.add(btn, 1, 4);

    shfaq.setGraphic(new ImageView(new Image("/sample/foto/eye.png")));
    shfaq.setOnMousePressed(e -> lblPw.setText(pw.getText()));
    shfaq.setOnMouseReleased(e -> lblPw.setText(""));

    user.setText(dk.log_user.getText());
    pw.setText(dk.log_pw.getText());
    user.setEditable(false);
    user.setTooltip(new Tooltip("Emri nuk mund te ndryshohet"));

    btnOk.setOnAction(e -> {
        if (pw.getText().length() > 5){
            rregullo(Integer.parseInt(dk.lblId.getText()));
        }else new Mesazhi("Info", "Fjalekalimi i shkurte", "Fjalekalimi duhet te jete mbi 5 karaktere i gjate.");
    });
    btnAnulo.setOnAction(e -> stage.close());

    pw.setOnKeyPressed(e -> {if (e.getCode().equals(KeyCode.ENTER)){
        if (pw.getText().length() > 5)
            rregullo(Integer.parseInt(dk.lblId.getText()));
        else new Mesazhi("Info", "Fjalekalimi i shkurte", "Fjalekalimi duhet te jete mbi 5 karaktere i gjate.");
    }});
    emri.setOnKeyPressed(e -> {if (e.getCode().equals(KeyCode.ENTER)){
        if (pw.getText().length() > 5)
            rregullo(Integer.parseInt(dk.lblId.getText()));
        else new Mesazhi("Info", "Fjalekalimi i shkurte", "Fjalekalimi duhet te jete mbi 5 karaktere i gjate.");
    }});

    root.setVgap(7);
    root.setHgap(5);
    root.setAlignment(Pos.CENTER);

    Scene scene = new Scene(root, 320, 210);
    scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:56,代码来源:ShtoPunetor.java

示例14: DashBoardPane

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
 * create a DashBoardPane
 * 
 * @param maxValue
 */
public DashBoardPane(Vehicle vehicle) {
  // LcdFont lcdFont=LcdFont.STANDARD;
  // LcdDesign lcdDesign=LcdDesign.SECTIONS;
  if (vehicle != null) {
    rpmGauge = GaugeBuilder.create().minValue(0)
        // FIXME use value from Vehicle definition
        .maxValue(vehicle.getMaxRPM()).tickLabelDecimals(0).decimals(0)
        .autoScale(true).animated(true).shadowsEnabled(true)
        .sectionsVisible(true)
        // FIXME use value form Vehicle definition
        .sections(new Section(vehicle.getMaxRPM() * 80 / 100,
            vehicle.getMaxRPM(), Color.rgb(195, 139, 102, 0.5)))
        .majorTickMarkColor(Color.rgb(241, 161, 71))
        // .minorTickMarkColor(Color.rgb(0, 175, 248))
        .majorTickMarkType(TickMarkType.TRAPEZOID)
        .mediumTickMarkType(TickMarkType.DOT)
        .minorTickMarkType(TickMarkType.LINE)
        .tickLabelLocation(TickLabelLocation.INSIDE)
        .title(I18n.get(I18n.REV_COUNT)).unit(I18n.get(I18n.RPM))
        .lcdDesign(LcdGauge.lcdDesign).lcdVisible(true)
        .lcdFont(LcdGauge.lcdFont).needleSize(NeedleSize.THICK).build();

    rpmSpeedGauge = GaugeBuilder.create().minValue(0)
        .maxValue(vehicle.getMaxSpeed()).tickLabelDecimals(0).decimals(1)
        .autoScale(true).animated(true).shadowsEnabled(true)
        .sectionsVisible(true)
        .sections(new Section(vehicle.getMaxSpeed() / 1.4,
            vehicle.getMaxSpeed(), Color.rgb(195, 139, 102, 0.5)))
        .majorTickMarkColor(Color.rgb(241, 161, 71))
        // .minorTickMarkColor(Color.rgb(0, 175, 248))
        .majorTickMarkType(TickMarkType.TRAPEZOID)
        .mediumTickMarkType(TickMarkType.DOT)
        .minorTickMarkType(TickMarkType.LINE)
        .tickLabelLocation(TickLabelLocation.INSIDE)
        .title(I18n.get(I18n.RPM_SPEED)).unit("km/h")
        .lcdDesign(LcdGauge.lcdDesign).lcdVisible(true)
        .lcdFont(LcdGauge.lcdFont).needleSize(NeedleSize.THICK).build();

    rpmMax = new ResetableGauge(I18n.get(I18n.RPM_MAX), I18n.get(I18n.RPM));
    rpmAvg = new ResetableGauge(I18n.get(I18n.RPM_AVG), I18n.get(I18n.RPM));
    // FIXME translate km/h? or allow miles/hour?
    rpmSpeedMax = new ResetableGauge(I18n.get(I18n.RPM_SPEED_MAX),
        I18n.get(I18n.KMH));
    rpmSpeedAvg = new ResetableGauge(I18n.get(I18n.RPM_SPEED_AVG),
        I18n.get(I18n.KMH));

    framedRPMGauge = new FGauge(rpmGauge, GaugeDesign.ENZO,
        GaugeBackground.DARK_GRAY);
    this.add(framedRPMGauge, 0, 0);

    GridPane rpmPane = new GridPane();
    rpmPane.add(rpmMax, 0, 0);
    rpmPane.add(rpmAvg, 1, 0);
    rpmPane.setAlignment(Pos.CENTER);
    this.add(rpmPane, 0, 1);

    framedRPMSpeedGauge = new FGauge(rpmSpeedGauge, GaugeDesign.ENZO,
        GaugeBackground.DARK_GRAY);
    this.add(framedRPMSpeedGauge, 1, 0);

    GridPane rpmSpeedPane = new GridPane();
    rpmSpeedPane.add(rpmSpeedMax, 0, 0);
    rpmSpeedPane.add(rpmSpeedAvg, 1, 0);
    rpmSpeedPane.setAlignment(Pos.CENTER);
    this.add(rpmSpeedPane, 1, 1);

    // 75= 80 - 5% (5% for extra gap)
    fixRowSizes(6, 87, 13);
    fixColumnSizes(4, 50, 50);
  } else {
    LOGGER.log(Level.WARNING,"Vehicle is null for DashBaordPane");
  }
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:79,代码来源:DashBoardPane.java

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


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