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

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

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

VBox.getHeight介绍

暂无

代码示例

代码示例来源: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. try {
  2. Graphics2D gd = (Graphics2D) image.getGraphics();
  3. gd.translate(vbox.getWidth(), vbox.getHeight());
  4. ImageIO.write(image, "png", file);
  5. } catch (IOException ex) {

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

  1. final KeyValue kv = new KeyValue(scrollRoot.vvalueProperty(), (top.getBoundsInLocal().getHeight() + ADJUSTMENT_RATIO) / root.getHeight());
  2. final KeyFrame kf = new KeyFrame(Duration.millis(500), kv);
  3. timeline.getKeyFrames().add(kf);

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

  1. primaryStage.show();
  2. double textHeight = vbox.getHeight() / vbox.getChildren().size();
  3. primaryStage.setHeight(textHeight*12+primaryStage.getHeight()-scene.getHeight());

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

  1. public class Main extends Application {
  2. @Override
  3. public void start(Stage primaryStage) throws Exception {
  4. ScrollPane pane = new ScrollPane();
  5. VBox box = new VBox();
  6. IntStream.range(1, 10).mapToObj(i -> new Label("Label" + i)).forEach(box.getChildren()::add);
  7. pane.setContent(box);
  8. Scene scene = new Scene(pane, 200, 50);
  9. primaryStage.setScene(scene);
  10. primaryStage.show();
  11. // Logic to scroll to the nth child
  12. Bounds bounds = pane.getViewportBounds();
  13. // get(3) is the index to `label4`.
  14. // You can change it to any label you want
  15. pane.setVvalue(box.getChildren().get(3).getLayoutY() *
  16. (1/(box.getHeight()-bounds.getHeight())));
  17. }
  18. }

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

相关文章