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

x33g5p2x  于2022-01-31 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(164)

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

VBox.setFillWidth介绍

暂无

代码示例

代码示例来源:origin: speedment/speedment

VBox.setVgrow(message, Priority.ALWAYS);
box.setFillWidth(true);
box.setSpacing(8);

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

void testLabelPlains1(VBox box) {
  box.setFillWidth(true);

  Label first = new Label("first");
  first.setAlignment(Pos.CENTER);
  first.setMaxWidth(Double.MAX_VALUE);
  first.setMaxHeight(Double.MAX_VALUE);
  VBox.setVgrow(first, Priority.ALWAYS);

  box.getChildren().addAll(first);
}

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

@Override
public void start(Stage primaryStage) throws Exception {
  Label topLabel = new Label("Top...");
  Label topLabel2 = new Label("Top 2...");

  Region rect = new Region();
  rect.setBackground(new Background(new BackgroundFill(Color.AQUA, CornerRadii.EMPTY, Insets.EMPTY)));

  Label bottomLabel = new Label("Bottom...");

  VBox vBox = new VBox();
  vBox.setFillWidth(true);

  VBox.setVgrow(rect, Priority.ALWAYS);

  vBox.getChildren().addAll(topLabel, topLabel2, rect, bottomLabel);

  Scene scene = new Scene (vBox, 300, 300, Color.BLANCHEDALMOND);
  primaryStage.setScene(scene);
  primaryStage.show();
}

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

void testLabelPlains2(VBox box) {
  box.setFillWidth(true);

  Label first = new Label("first");
  first.setAlignment(Pos.CENTER);
  first.setMaxWidth(Double.MAX_VALUE);
  first.setMaxHeight(Double.MAX_VALUE);
  VBox.setVgrow(first, Priority.ALWAYS);

  first.heightProperty().addListener(p -> {
    first.setFont(first.getFont().font(first.getHeight()*0.7));
  });

  box.getChildren().addAll(first);
}

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

@Override
public void start(Stage primaryStage) throws Exception{
  DatePicker datePicker = new DatePicker();
  Label label = new Label();
  Bindings.bindBidirectional(label.textProperty(), datePicker.valueProperty(), new LocalDateStringConverter());
  Button today = new Button("Set today's date");
  today.setOnAction(event-> datePicker.setValue(LocalDate.now()));
  Button clear = new Button("Clear date");
  clear.setOnAction(event-> datePicker.setValue(null));

  VBox root = new VBox(5, datePicker,
      new HBox(5, new Label("Date of Birth: "), label),
      new HBox(5, today, clear));
  root.setAlignment(Pos.CENTER);
  root.setFillWidth(false);
  Scene scene = new Scene(root, 400, 100);
  primaryStage.setScene(scene);
  primaryStage.show();
}

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

@Override
public void start(Stage primaryStage) {
  ImageView iv = new ImageView();
  ProgressBar pb = new ProgressBar();
  Button btn = new Button("Load Image");
  btn.setOnAction((ActionEvent event) -> {
    // ca. 6 MB image loaded from web
    Image image = new Image("http://eoimages.gsfc.nasa.gov/images/imagerecords/79000/79793/city_lights_africa_8k.jpg", true);
    pb.progressProperty().bind(image.progressProperty());
    iv.setImage(image);
  });

  ScrollPane sp = new ScrollPane(iv);
  VBox.setVgrow(sp, Priority.ALWAYS);
  VBox root = new VBox(btn, pb, sp);
  root.setFillWidth(true);

  Scene scene = new Scene(root);
  primaryStage.setMaximized(true);

  primaryStage.setScene(scene);
  primaryStage.show();
}

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Creates the expandable content component of the {@link ErrorDialog}
 *
 * @return The expandable content component of the {@link ErrorDialog}
 */
private VBox createExpandableContent() {
  final Label label = new Label(tr("Stack trace:"));
  final TextArea textArea = new TextArea();
  textArea.setEditable(false);
  textArea.textProperty().bind(Bindings.createStringBinding(
      () -> Optional.ofNullable(getException()).map(ExceptionUtils::getFullStackTrace).orElse(null),
      exception));
  VBox.setVgrow(textArea, Priority.ALWAYS);
  final VBox container = new VBox(label, textArea);
  container.setFillWidth(true);
  return container;
}

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

public class Test extends Application {

 @Override
  public void start(Stage primaryStage) {

    TextField txtInput = new TextField();

    VBox boxTextFields = new VBox();
    boxTextFields.setAlignment(Pos.TOP_RIGHT);
    boxTextFields.setFillWidth(false);

    ScrollPane scrollPane = new ScrollPane(boxTextFields);
    scrollPane.setFitToWidth(true);

    Button button = new Button();
    button.setOnAction(e -> boxTextFields.getChildren().add(new TextField(txtInput.getText())));

    VBox root = new VBox(textField, button, scrollPane);
    root.setAlignment(Pos.TOP_CENTER);

    primaryStage.setScene(new Scene(root, 300, 300));
    primaryStage.show();
  }

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

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

public void start(final Stage stage) throws Exception {
  final Button button0 = new Button("Start learning");
  final Button button1 = new Button("Customize");

  final VBox box = new VBox();
  box.setFillWidth(true);

  box.getChildren().setAll(button0, button1);
  box.setAlignment(Pos.CENTER);

  stage.setScene(new Scene(box));
  stage.setWidth(200);
  stage.setHeight(100);
  stage.show();
}

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

root.setFillWidth(false);
VBox.setVgrow(canvasContainer, Priority.NEVER);
root.setAlignment(Pos.CENTER);

代码示例来源:origin: org.controlsfx/controlsfx

private VBox createVerticalButtonBox() {
  VBox box = new VBox(5);
  box.setFillWidth(true);
  FontAwesome fontAwesome = new FontAwesome();
  moveToTarget = new Button("",
      fontAwesome.create(FontAwesome.Glyph.ANGLE_RIGHT));
  moveToTargetAll = new Button("",
      fontAwesome.create(FontAwesome.Glyph.ANGLE_DOUBLE_RIGHT));
  moveToSource = new Button("",
      fontAwesome.create(FontAwesome.Glyph.ANGLE_LEFT));
  moveToSourceAll = new Button("",
      fontAwesome.create(FontAwesome.Glyph.ANGLE_DOUBLE_LEFT));
  updateButtons();
  
  box.getChildren().addAll(moveToTarget, moveToTargetAll, moveToSource,
      moveToSourceAll);
  return box;
}

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

VBox menu = new VBox();
menu.setStyle("-fx-background-color: blue;");
menu.setFillWidth(true);
Button backBtn = new Button("Left Arrow");
backBtn.setPrefWidth(100);

相关文章