當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。