javafx.scene.layout.HBox.setAlignment()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中javafx.scene.layout.HBox.setAlignment()方法的一些代码示例,展示了HBox.setAlignment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBox.setAlignment()方法的具体详情如下:
包路径:javafx.scene.layout.HBox
类名称:HBox
方法名:setAlignment

HBox.setAlignment介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

controls.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

Stage stage = new Stage();
stage.setTitle("Hello World");

final BorderPane border = new BorderPane();
Scene scene = new Scene(border);

Button button = new Button("test");

HBox outerHBox = new HBox();
outerHBox.getChildren().add(button);
outerHBox.setAlignment(Pos.CENTER);

border.setCenter(outerHBox);

stage.setScene(scene);

代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx

final HBox buttons = new HBox(10);
buttons.getChildren().addAll(ok, cancel);
buttons.setAlignment(Pos.CENTER);
buttons.setPadding(ins);
box.getChildren().addAll(text, buttons);
dialogStage.setScene(new Scene(box));
ok.setCancelButton(false);

代码示例来源:origin: jfoenixadmin/JFoenix

hbox.getChildren().addAll(button, tabPane);
hbox.setSpacing(50);
hbox.setAlignment(Pos.CENTER);
hbox.setStyle("-fx-padding:20");
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

hbox.setAlignment(Pos.CENTER);
hbox.getChildren().add(okBtn);
hbox.getChildren().add(cancelBtn);
dialog.setScene(scene);
dialog.initOwner(primaryStage);
dialog.initModality(Modality.NONE);

代码示例来源:origin: stackoverflow.com

navBar.setAlignment(Pos.CENTER);
navBar.setPrefHeight(42);
});
primaryStage.setScene(scene);

代码示例来源:origin: jfoenixadmin/JFoenix

nodesList.addAnimatedNode(button1);
final HBox container = new HBox(new JFXButton("INFO"), button2);
container.setAlignment(Pos.CENTER_RIGHT);
container.setSpacing(12);
nodesList.addAnimatedNode(container, (expanded, duration) -> {
stage.setScene(scene);
stage.show();

代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx

final HBox buttons = new HBox(10);
buttons.getChildren().addAll(ok, cancel);
buttons.setAlignment(Pos.CENTER);
buttons.setPadding(ins);
box.getChildren().addAll(text, line, buttons);
dialogStage.setScene(new Scene(box));
ok.setCancelButton(false);

代码示例来源:origin: stackoverflow.com

);
stage.setScene(scene);
stage.show();
    keyRow.getStyleClass().add("key-row");
    keyRow.setAlignment(Pos.CENTER);
    for (char c: row.toCharArray()) {
      KeyButton key = new KeyButton(Character.toString(c));

代码示例来源:origin: stackoverflow.com

Scene scene = new Scene(root);
scene.getStylesheets().add(this.getClass().getResource("style.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("Progress Controls");
hb.setAlignment(Pos.CENTER);
hb.getChildren().addAll(pane, pi);
stage.show();

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
 hbox.getChildren().add(new Label("Tab" + i));
 hbox.setAlignment(Pos.CENTER);
 tab.setContent(hbox);
 tabPane.getTabs().add(tab);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

ValidationDemo.class.getResource("context.css")
        .toExternalForm());
stage.setScene(scene);
stage.show();
hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
hbBtn.getChildren().add(btn);
grid.add(hbBtn, 1, 4);

代码示例来源:origin: stackoverflow.com

root.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class UpdatingComboBox extends Application {

  @Override
  public void start(Stage primaryStage) {
    ComboBox<String> combo = new ComboBox<>();
    combo.setEditable(true);
    combo.valueProperty().addListener((obs, oldValue, newValue) -> {
      if (newValue != null && ! combo.getItems().contains(newValue)) {
        combo.getItems().add(newValue);
      }
    });
    HBox root = new HBox(combo);
    root.setAlignment(Pos.TOP_CENTER);
    primaryStage.setScene(new Scene(root, 350, 150));
    primaryStage.show();
  }

  public static void main(String[] args) {
    launch(args);
  }
}

代码示例来源:origin: stackoverflow.com

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class Main extends Application {

  public void start(Stage primaryStage) {
    Button button = new Button("Click");
    HBox container = new HBox(button);
    container.setAlignment(Pos.CENTER);
    Scene scene = new Scene(container, 200, 200);
    scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
    primaryStage.setScene(scene);
    primaryStage.show();
  }

  public static void main(String[] args) {
    launch(args);
  }

}

代码示例来源:origin: stackoverflow.com

public void start(Stage primaryStage) {
  HBox hbox = new HBox(10);
  TextField field = new TextField();
  HBox.setHgrow(field, Priority.ALWAYS);
  hbox.setAlignment(Pos.BASELINE_LEFT);
  hbox.getChildren().addAll(
    new Label("Search:"), field, new Button("Go")
  );
  hbox.setPadding(new Insets(10));

  Scene scene = new Scene(hbox, 600, 250, Color.WHITE);
  primaryStage.setScene(scene);
  primaryStage.show();
}

代码示例来源:origin: stackoverflow.com

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class UpdateStageTitle extends Application {

  @Override
  public void start(Stage primaryStage) {
    TextField titleField = new TextField();
    titleField.textProperty().addListener((obs, oldText, newText) -> 
      primaryStage.setTitle(newText));
    HBox root = new HBox(5, new Label("Window title: "), titleField);
    root.setAlignment(Pos.CENTER);
    Scene scene = new Scene(root, 350, 75);
    primaryStage.setScene(scene);
    primaryStage.show();
  }

  public static void main(String[] args) {
    launch(args);
  }
}

代码示例来源:origin: stackoverflow.com

root.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

container.setAlignment(Pos.CENTER);
container.setPadding(new Insets(10));
pane.setCenter(container);
Scene scene = new Scene(pane, 150, 150);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: stackoverflow.com

checkInBox.setAlignment(Pos.CENTER);
checkOutBox.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();

相关文章