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

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

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

VBox.widthProperty介绍

暂无

代码示例

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

Screen screen = Screen.getPrimary();
 Rectangle2D bounds = screen.getVisualBounds();
 //let the window use the left half screen:
 stage.setX(bounds.getMinX());
 stage.setY(bounds.getMinY());
 stage.setWidth(bounds.getWidth() / 2);
 stage.setHeight(bounds.getHeight());
 VBox vBox = new VBox();
 vBox.setStyle("-fx-background-color: blue;");
 Rectangle rect = new Rectangle();
 rect.setStyle("-fx-fill: red;");
 vBox.getChildren().add(rect);
 //not necessary, because always max size (root element of the scene):
 //vBox.minWidthProperty().bind(stage.widthProperty());
 //vBox.minHeightProperty().bind(stage.heightProperty());
 rect.widthProperty().bind(vBox.widthProperty());
 rect.heightProperty().bind(vBox.heightProperty().divide(3));
 stage.setScene(new Scene(vBox));
 stage.show();

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

VBox root = new VBox();
root.setAlignment(Pos.TOP_CENTER);
final ProgressBar browser = new ProgressBar();
browser.prefWidthProperty().bind(root.widthProperty().subtract(20));  //  -20 is for 
  // padding from right and left, since we aligned it to TOP_CENTER.
root.getChildren().add(browser);

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

void testLabelPlains3(VBox box) {        
  Text first = new Text("first");

  box.heightProperty().addListener(p -> {
    first.setScaleY(0.8*box.getHeight()/20);
    first.setTranslateY(box.getHeight()/2);
  });
  box.widthProperty().addListener(p -> {
    first.setScaleX(0.8*box.getWidth()/30);
    first.setTranslateX(box.getWidth()/2);
  });

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

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

textField.prefWidthProperty().bind(container.widthProperty().subtract(button.prefWidthProperty()));

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  followButton.setDisable(true);
  userBanner.fitWidthProperty().bind(userDetailsVBox.widthProperty());
  userBanner.fitHeightProperty().bind(userDetailsVBox.heightProperty());
  userBanner.setPreserveRatio(false);
  userBanner.setImage(ImageResources.BACKGROUND_DARK_1PX.getImage());
  userProfilePictureImageView.setImage(ImageResources.GENERAL_USER_AVATAR_LIGHT.getImage());
  final Rectangle profilePictureClip = Clipping.getSquareClip(290.0, 50.0);
  userProfilePictureImageView.setClip(profilePictureClip);
  if (targetUserProp.getValue() == null) {
    this.targetUserProp.addListener((o, prev, cur) -> displayTargetUser());
  } else {
    displayTargetUser();
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
  final VBox container = new VBox(createMiniature(), createLabel());
  container.getStyleClass().add("iconListElement");
  container.widthProperty().addListener((observable, oldValue, newValue) -> container
      .setClip(new Rectangle(container.getWidth(), container.getHeight())));
  container.heightProperty().addListener((observable, oldValue, newValue) -> container
      .setClip(new Rectangle(container.getWidth(), container.getHeight())));
  // update the selected pseudo class according to the selected state of the component
  getControl().selectedProperty().addListener((Observable invalidation) -> container
      .pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected()));
  // adopt the selected state during initialisation
  container.pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected());
  getChildren().addAll(container);
}

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

vbox.widthProperty().addListener(resizeListener);
vbox.heightProperty().addListener(resizeListener);

相关文章