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

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

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

VBox.heightProperty介绍

暂无

代码示例

代码示例来源: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

static class InfiniteNumberItem extends TreeItem<String> {
  boolean expanded = false;
  public InfiniteNumberItem(String name) {
    super(name);
  }

  @Override public ObservableList<TreeItem<String>> getChildren() {
    if (!expanded) {
      for (int i = 0; i < 10; i++)  {
        super.getChildren().add(new InfiniteNumberItem(""+i));
      }
      expanded = true;
    }
    return super.getChildren();
  }
  @Override public boolean isLeaf() {
    return false;
  }
}

void testTreeInfinite(VBox box) { 
  TreeView<String> tree = new TreeView<String>();
  tree.prefHeightProperty().bind(box.heightProperty());

  tree.setRoot(new InfiniteNumberItem("3."));
  box.getChildren().add(tree);
}

代码示例来源: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

box.heightProperty().addListener((ov, oldValue, newValue) -> {
  pane.setVvalue(pane.getVmax());
});

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

vbox.heightProperty().addListener(resizeListener);

代码示例来源: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);
}

相关文章