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

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

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

VBox.getHeight介绍

暂无

代码示例

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

try {
  Graphics2D gd = (Graphics2D) image.getGraphics();
  gd.translate(vbox.getWidth(), vbox.getHeight());
  ImageIO.write(image, "png", file);
} catch (IOException ex) {

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

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

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

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

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

public class Main extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
    ScrollPane pane = new ScrollPane();
    VBox box = new VBox();
    IntStream.range(1, 10).mapToObj(i -> new Label("Label" + i)).forEach(box.getChildren()::add);
    pane.setContent(box);
    Scene scene = new Scene(pane, 200, 50);
    primaryStage.setScene(scene);
    primaryStage.show();

    // Logic to scroll to the nth child
    Bounds bounds = pane.getViewportBounds();
    // get(3) is the index to `label4`.
    // You can change it to any label you want
    pane.setVvalue(box.getChildren().get(3).getLayoutY() * 
               (1/(box.getHeight()-bounds.getHeight())));
  }
}

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

相关文章