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

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

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

VBox.widthProperty介绍

暂无

代码示例

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

  1. Screen screen = Screen.getPrimary();
  2. Rectangle2D bounds = screen.getVisualBounds();
  3. //let the window use the left half screen:
  4. stage.setX(bounds.getMinX());
  5. stage.setY(bounds.getMinY());
  6. stage.setWidth(bounds.getWidth() / 2);
  7. stage.setHeight(bounds.getHeight());
  8. VBox vBox = new VBox();
  9. vBox.setStyle("-fx-background-color: blue;");
  10. Rectangle rect = new Rectangle();
  11. rect.setStyle("-fx-fill: red;");
  12. vBox.getChildren().add(rect);
  13. //not necessary, because always max size (root element of the scene):
  14. //vBox.minWidthProperty().bind(stage.widthProperty());
  15. //vBox.minHeightProperty().bind(stage.heightProperty());
  16. rect.widthProperty().bind(vBox.widthProperty());
  17. rect.heightProperty().bind(vBox.heightProperty().divide(3));
  18. stage.setScene(new Scene(vBox));
  19. stage.show();

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

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

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

  1. void testLabelPlains3(VBox box) {
  2. Text first = new Text("first");
  3. box.heightProperty().addListener(p -> {
  4. first.setScaleY(0.8*box.getHeight()/20);
  5. first.setTranslateY(box.getHeight()/2);
  6. });
  7. box.widthProperty().addListener(p -> {
  8. first.setScaleX(0.8*box.getWidth()/30);
  9. first.setTranslateX(box.getWidth()/2);
  10. });
  11. box.getChildren().addAll(first);
  12. }

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

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

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

  1. @Override
  2. public void initialize() {
  3. followButton.setDisable(true);
  4. userBanner.fitWidthProperty().bind(userDetailsVBox.widthProperty());
  5. userBanner.fitHeightProperty().bind(userDetailsVBox.heightProperty());
  6. userBanner.setPreserveRatio(false);
  7. userBanner.setImage(ImageResources.BACKGROUND_DARK_1PX.getImage());
  8. userProfilePictureImageView.setImage(ImageResources.GENERAL_USER_AVATAR_LIGHT.getImage());
  9. final Rectangle profilePictureClip = Clipping.getSquareClip(290.0, 50.0);
  10. userProfilePictureImageView.setClip(profilePictureClip);
  11. if (targetUserProp.getValue() == null) {
  12. this.targetUserProp.addListener((o, prev, cur) -> displayTargetUser());
  13. } else {
  14. displayTargetUser();
  15. }
  16. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void initialise() {
  6. final VBox container = new VBox(createMiniature(), createLabel());
  7. container.getStyleClass().add("iconListElement");
  8. container.widthProperty().addListener((observable, oldValue, newValue) -> container
  9. .setClip(new Rectangle(container.getWidth(), container.getHeight())));
  10. container.heightProperty().addListener((observable, oldValue, newValue) -> container
  11. .setClip(new Rectangle(container.getWidth(), container.getHeight())));
  12. // update the selected pseudo class according to the selected state of the component
  13. getControl().selectedProperty().addListener((Observable invalidation) -> container
  14. .pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected()));
  15. // adopt the selected state during initialisation
  16. container.pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected());
  17. getChildren().addAll(container);
  18. }

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

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

相关文章